Skip to content

Commit

Permalink
Revert "Updated the version output to use Go module build information…
Browse files Browse the repository at this point in the history
… if available. Enabled GoReleaser module proxying for verifiable builds."

This reverts commit 2a3f049.
  • Loading branch information
andreynering committed Apr 17, 2021
1 parent a57beb1 commit e79354a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 28 deletions.
5 changes: 0 additions & 5 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ build:
goarch: 386
env:
- CGO_ENABLED=0
ldflags:
- -s -w # Don't set main.version.

gomod:
proxy: true

archives:
- name_template: "{{.Binary}}_{{.Os}}_{{.Arch}}"
Expand Down
2 changes: 0 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
([#135](https://github.com/go-task/task/issues/135)).
- Print task name before the command in the log output
([#398](https://github.com/go-task/task/pull/398)).
- Improve version reporting when building Task from source using Go Modules
([#462](https://github.com/go-task/task/pull/462)).

## v3.3.0 - 2021-03-20

Expand Down
25 changes: 4 additions & 21 deletions cmd/task/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"os"
"os/signal"
"path/filepath"
"runtime/debug"
"strings"
"syscall"

Expand All @@ -19,7 +18,9 @@ import (
"github.com/go-task/task/v3/taskfile"
)

var version = ""
var (
version = "master"
)

const usage = `Usage: task [-ilfwvsd] [--init] [--list] [--force] [--watch] [--verbose] [--silent] [--dir] [--taskfile] [--dry] [--summary] [task...]
Expand Down Expand Up @@ -92,7 +93,7 @@ func main() {
pflag.Parse()

if versionFlag {
fmt.Printf("Task version: %s\n", getVersion())
fmt.Printf("Task version: %s\n", version)
return
}

Expand Down Expand Up @@ -216,21 +217,3 @@ func getSignalContext() context.Context {
}()
return ctx
}

func getVersion() string {
if version != "" {
return version
}

info, ok := debug.ReadBuildInfo()
if !ok || info.Main.Version == "" {
return "unknown"
}

version = info.Main.Version
if info.Main.Sum != "" {
version += fmt.Sprintf(" (%s)", info.Main.Sum)
}

return version
}

0 comments on commit e79354a

Please sign in to comment.