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

[Feature request] Add version and expose through flag #53

Closed
mx-psi opened this issue Dec 31, 2020 · 2 comments
Closed

[Feature request] Add version and expose through flag #53

mx-psi opened this issue Dec 31, 2020 · 2 comments

Comments

@mx-psi
Copy link

mx-psi commented Dec 31, 2020

Hi, it would be useful for debugging if ineffassign was versioned and one could get that version through --version flag. Right now it's hard to know what version of ineffassign is installed. Ideally one would get the commit of the build but I don't know if that can be done easily and keep the installation through go get.

@gordonklaus
Copy link
Owner

I can see how this would be useful if you don't have control over which version you're running. Maybe in the meantime you can depend on a specific version? go get supports version tags, as in:

GO111MODULE=on go get github.com/gordonklaus/ineffassign@v0.0.0-20210103220932-664217a59c00

(You need GO111MODULE=on when running outside a module, until Go module mode is the default.)

It looks like we might be able to use runtime/debug.BuildInfo to get the version but I also see that there are open issues about getting the version of the main module. Needs investigation.

@kolyshkin
Copy link

With go 1.18, you can use

[kir@kir-rhat ~]$ go version -m `which ineffassign`
/home/kir/go/bin/ineffassign: go1.18.1
	path	github.com/gordonklaus/ineffassign
	mod	github.com/gordonklaus/ineffassign	v0.0.0-20210914165742-4cc7213b9bc8	h1:PVRE9d4AQKmbelZ7emNig1+NT27DUmKZn5qXxfio54U=
	dep	golang.org/x/mod	v0.4.2	h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo=
	dep	golang.org/x/sys	v0.0.0-20210510120138-977fb7262007	h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE=
	dep	golang.org/x/tools	v0.1.5	h1:ouewzE6p+/VEB31YYnTbEJdi8pFqKp4P4n85vwo3DHA=
	dep	golang.org/x/xerrors	v0.0.0-20200804184101-5ec99f83aff1	h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
	build	-compiler=gc
	build	CGO_ENABLED=1
	build	CGO_CFLAGS=
	build	CGO_CPPFLAGS=
	build	CGO_CXXFLAGS=
	build	CGO_LDFLAGS=
	build	GOARCH=amd64
	build	GOOS=linux
	build	GOAMD64=v1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants