Skip to content

affected/package: go fmt reformat code generated files (.pb.go) #55157

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
trinwin opened this issue Sep 19, 2022 · 1 comment
Closed

affected/package: go fmt reformat code generated files (.pb.go) #55157

trinwin opened this issue Sep 19, 2022 · 1 comment

Comments

@trinwin
Copy link

trinwin commented Sep 19, 2022

What version of Go are you using (go version)?

$ go version
go version go1.19 darwin/arm64

Does this issue reproduce with the latest release?

Unknown

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="arm64"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOINSECURE=""
GOOS="darwin"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/opt/homebrew/Cellar/go/1.19/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/opt/homebrew/Cellar/go/1.19/libexec/pkg/tool/darwin_arm64"
GOVCS=""
GOVERSION="go1.19"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/sw/7t2y_9r94_5_3_5fgwbg75gm0000gn/T/go-build3258316285=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

I ran go fmt ./... and it reformatted some comment spacing in my code generated .pb.go file

What did you expect to see?

The command should not format code generated files.

@cherrymui
Copy link
Member

gofmt or the go command does not know which files are generated. It is up to the user (or the project) to decide which file should be formatted, which should not. Also, generated files usually are already well formatted.

Closing as working as intended. Thanks.

@cherrymui cherrymui closed this as not planned Won't fix, can't repro, duplicate, stale Sep 19, 2022
@golang golang locked and limited conversation to collaborators Sep 19, 2023
@seankhliao seankhliao marked this as a duplicate of #73181 Apr 5, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants