Skip to content
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

go run -gcflags '-unused_pkgs' main.go isnt working #41258

Closed
machinexa2 opened this issue Sep 7, 2020 · 1 comment
Closed

go run -gcflags '-unused_pkgs' main.go isnt working #41258

machinexa2 opened this issue Sep 7, 2020 · 1 comment

Comments

@machinexa2
Copy link

@machinexa2 machinexa2 commented Sep 7, 2020

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

go 1.14.7 linux/amd64

$ go version

Does this issue reproduce with the latest release?

yes

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

root@kali-linux:~/Music# go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOENV="/root/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/opt/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/go-1.14"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go-1.14/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build022602942=/tmp/go-build -gno-record-gcc-switches"

go env Output
$ go env

What did you do?

https://stackoverflow.com/questions/19560334/how-to-disable-golang-unused-import-error
followed this

What did you expect to see?

no error on not using var and imports

What did you see instead?

error

@ALTree
Copy link
Member

@ALTree ALTree commented Sep 7, 2020

go run -gcflags '-unused_pkgs'

That's not a supported option. Read that answer in full:

To get around this, I changed around my compiler to allow optional flags for allowing unused variables and imports in my code.

They changed the compiler code to add that option, it's not something that works on the official Go compiler.

Closing here since this is not a bug.

@ALTree ALTree closed this Sep 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.