-
Notifications
You must be signed in to change notification settings - Fork 607
Support --version flag or similar option in mockgen #250
Comments
This is a great idea. The only hard part is how to supply the version. I think most developers pull I think if we want to supply this, then we need to start publishing this stuff to github and encourage people to get it from there. @balshetzer Do you have any thoughts? |
@codyoss @poy any plans to work on this soon? I've just spent half a day debugging a Right now on master the
These commands will just install the latest code from I think using compile flags and uploading the binaries with the release is a really good approach going forward - adding the |
I know some libraries just have a constant string that gets exposed. We could write a release script that automatically bumps it, etc. I have no strong opinions. |
My suggestion of how to address this is in #362 . Since most of the people use I think exposed constant string is a little bit of a hassle. Lets say we bump the constant string to |
to be perfectly honest the way we implement this for our services is
VERSION ?= $(shell git rev-parse --short HEAD)
LDFLAGS = -ldflags "-X main.version=$(VERSION) -X main.appName=$(APP_NAME)"
.PHONY: build
build: ## Build the binary
@echo "Building binary"
$(GOENV) go build $(LDFLAGS) -a -installsuffix cgo \
-o $(APP_NAME) ./cmd/$(APP_NAME)
var (
appName = "ext-auth"
version = "1.0.0"
) So by default its the commit message, and any release is the semantic version. But this only works for built artifacts, i guess it wont work with a |
If this solution works as you say in #362:
And I can run
and it will install the latest released version into my Can you clarify that this is the behaviour once |
@Rossiar thanks for checking in. Yes that is the behavior I want to introduce. If you will run the command
You will be (after |
LGTM - @codyoss I think this can be closed |
It would be nice to be able to know what version of mockgen I have installed via a flag or command, like:
mockgen -v
mockgen -version
mockgen --version
mockgen version
Any of the above, really.
The text was updated successfully, but these errors were encountered: