You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
attempt to handle --version even in untagged builds (#161)
If we are installed via `go-install` rather than downloading a
tagged binary from github, the `Tag` etc variables will all be
empty, and therefore the `--version` flag is diked out. But there
is a way around this!
If the version info is not filled in via build-time flags, use
`debug.BuildInfo` to introspect as much information as we can
out of the module metadata:
```
$ go install github.com/odenio/goimports-reviser/[email protected]
go: downloading github.com/odenio/goimports-reviser/v3 v3.6.6-pre5
$ ~/go/bin/goimports-reviser --version
version: 3.6.6-pre5
built with: go1.22.4
tag: v3.6.6-pre5
commit: n/a
source: github.com/odenio/goimports-reviser/v3
```
Additionally, add a `--version-only` flag that prints only the version
string itself, handy for use in shell pipelines. Can be used on its own
or in combination with the `--version` flag:
```
$ ./go/bin/goimports-reviser --version-only
3.6.6-pre5
```
"Apply imports sorting and formatting(if the option is set) to generated files. Generated file is a file with first comment which starts with comment '// Code generated'. Optional parameter.",
deprecatedMessagesCh<-fmt.Sprintf("-%s is deprecated. Put file name as last argument to the command(Example: goimports-reviser -rm-unused -set-alias -format goimports-reviser/main.go)", filePathArg)
0 commit comments