traefik / traefik-migration-tool

A migration tool from Traefik v1 to Traefik v2
https://docs.traefik.io/migration/v1-to-v2/
Apache License 2.0
151 stars 35 forks source link

Source tarball does not build on NixOS #5

Closed ghost closed 4 years ago

ghost commented 4 years ago

To reproduce:

$ tar -zxf traefik-migration-tool-0.9.0.tar.gz 
$ cd traefik-migration-tool-0.9.0/
$ make
fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
golangci-lint run
WARN Failed to discover go env: failed to run 'go env': exit status 2 
ERRO Running error: context loading failed: failed to load program with go/packages: unsupported version of go: exit status 2: flag provided but not defined: -compiled
usage: list [-e] [-f format] [-json] [build flags] [packages]
[…]

Looks like it's not meant to be built outside of a Git repo, and it doesn't say which version of Go it needs. For reference:

$ go version
go version go1.4-bootstrap-20161024 linux/amd64
ldez commented 4 years ago

hello,

the source package is automatically created by Github for a release, so we cannot disable it.

I recommend to clone the repo instead of using this tarball.

If you really want to use the Github generated tarball, use go build -v -ldflags '-X "main.Version=${VERSION}" -X "main.ShortCommit=undefined"' . instead of the makefile.

The minimum Go version is define inside the go.mod https://github.com/containous/traefik-migration-tool/blob/05905da260f9ed83f7cc6feb180672bb59e0355f/go.mod#L3

ghost commented 4 years ago

For the record, it builds and runs after using nix-env -iA nixos.go rather than nix-env -iA nixos.go_bootstrap.