From f55e704363f93cf26a2d6b611bc5dceb768496b8 Mon Sep 17 00:00:00 2001 From: Martin Baillie Date: Sat, 18 Jan 2025 21:30:53 +1100 Subject: [PATCH] Remove gomod2nix and update Go build configuration Signed-off-by: Martin Baillie --- .goreleaser.yml | 4 +- flake.lock | 55 ---------- flake.nix | 26 ++--- gomod2nix.toml | 276 ------------------------------------------------ 4 files changed, 9 insertions(+), 352 deletions(-) delete mode 100644 gomod2nix.toml diff --git a/.goreleaser.yml b/.goreleaser.yml index 3be6945..01f52ee 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,7 +1,9 @@ report_sizes: false builds: - - goos: + - env: + - CGO_ENABLED=0 + goos: - darwin - windows - linux diff --git a/flake.lock b/flake.lock index aee9e8b..41d8112 100644 --- a/flake.lock +++ b/flake.lock @@ -38,24 +38,6 @@ "type": "github" } }, - "flake-utils": { - "inputs": { - "systems": "systems" - }, - "locked": { - "lastModified": 1694529238, - "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, "gitignore": { "inputs": { "nixpkgs": [ @@ -76,27 +58,6 @@ "type": "github" } }, - "gomod2nix": { - "inputs": { - "flake-utils": "flake-utils", - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1733668782, - "narHash": "sha256-tPsqU00FhgdFr0JiQUiBMgPVbl1jbPCY5gbFiJycL3I=", - "owner": "nix-community", - "repo": "gomod2nix", - "rev": "514283ec89c39ad0079ff2f3b1437404e4cba608", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "gomod2nix", - "type": "github" - } - }, "nixpkgs": { "locked": { "lastModified": 1737062831, @@ -130,24 +91,8 @@ "devshell": "devshell", "flake-parts": "flake-parts", "gitignore": "gitignore", - "gomod2nix": "gomod2nix", "nixpkgs": "nixpkgs" } - }, - "systems": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 39c9d02..7e15b97 100644 --- a/flake.nix +++ b/flake.nix @@ -10,11 +10,6 @@ inputs.nixpkgs.follows = "nixpkgs"; }; - gomod2nix = { - url = "github:nix-community/gomod2nix"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - gitignore = { url = "github:hercules-ci/gitignore.nix"; inputs.nixpkgs.follows = "nixpkgs"; @@ -27,7 +22,6 @@ nixpkgs, flake-parts, devshell, - gomod2nix, gitignore, ... }: @@ -52,7 +46,6 @@ rev = self.rev or "dirty"; ver = if self ? "dirtyRev" then self.dirtyShortRev else self.shortRev; date = self.lastModifiedDate or "19700101"; - go = pkgs.go_1_22; in { _module.args.pkgs = import nixpkgs { @@ -60,25 +53,20 @@ config.allowUnfree = true; # BSL2... Hashicorp... overlays = [ devshell.overlays.default - gomod2nix.overlays.default ]; }; - packages.default = gomod2nix.legacyPackages.${system}.buildGoApplication { - inherit name go; + packages.default = pkgs.buildGo123Module { + inherit name; src = gitignore.lib.gitignoreSource ./.; - # Must be added due to bug: - # https://github.com/nix-community/gomod2nix/issues/120 - pwd = ./.; - modules = ./gomod2nix.toml; + env.CGO_ENABLED = 0; + vendorHash = "sha256-hscwOZhaVL17HPUGfs8uYSQt80D4HK4W6kNdkSmsQdA="; flags = [ "-trimpath" ]; - # CGO_ENABLED = 0; ldflags = [ "-s" "-w" "-extld ld" - "-extldflags" - "-static" + "-extldflags -static" "-X ${package}/github.projectName=${name}" "-X ${package}/github.projectDocs=https://${package}" "-X github.com/prometheus/common/version.BuildDate=${date}" @@ -88,7 +76,6 @@ "-X github.com/prometheus/common/version.Branch=main" "-X github.com/prometheus/common/version.BuildUser=nix" ]; - doCheck = false; }; devShells.default = pkgs.devshell.mkShell rec { @@ -112,7 +99,6 @@ gnugrep go golangci-lint - gomod2nix.legacyPackages.${system}.gomod2nix goreleaser syft vault-bin @@ -161,7 +147,7 @@ prjRoot + '' echo >&2 "==> Tidying modules" - go mod tidy && gomod2nix + go mod tidy ''; help = "clean transient files"; } diff --git a/gomod2nix.toml b/gomod2nix.toml deleted file mode 100644 index bd5045a..0000000 --- a/gomod2nix.toml +++ /dev/null @@ -1,276 +0,0 @@ -schema = 3 - -[mod] - [mod."github.com/Microsoft/go-winio"] - version = "v0.6.2" - hash = "sha256-tVNWDUMILZbJvarcl/E7tpSnkn7urqgSHa2Eaka5vSU=" - [mod."github.com/armon/go-metrics"] - version = "v0.4.1" - hash = "sha256-usxTUHA0QQMdM6sHi2z51nmnEKMbA0qUilxJFpWHlYE=" - [mod."github.com/armon/go-radix"] - version = "v1.0.0" - hash = "sha256-A5SNdGtw8I6ngk9U3p+rKu6KB7inSngqmdnJl74EM9Q=" - [mod."github.com/beorn7/perks"] - version = "v1.0.1" - hash = "sha256-h75GUqfwJKngCJQVE5Ao5wnO3cfKD9lSIteoLp/3xJ4=" - [mod."github.com/bradleyfalzon/ghinstallation"] - version = "v1.1.1" - hash = "sha256-lLmRG7al4j7+erf7mHwa/d+Sdj5RqnXRgN3RwkxNVqQ=" - [mod."github.com/cenkalti/backoff/v4"] - version = "v4.3.0" - hash = "sha256-wfVjNZsGG1WoNC5aL+kdcy6QXPgZo4THAevZ1787md8=" - [mod."github.com/cespare/xxhash/v2"] - version = "v2.3.0" - hash = "sha256-7hRlwSR+fos1kx4VZmJ/7snR7zHh8ZFKX+qqqqGcQpY=" - [mod."github.com/davecgh/go-spew"] - version = "v1.1.2-0.20180830191138-d8f796af33cc" - hash = "sha256-fV9oI51xjHdOmEx6+dlq7Ku2Ag+m/bmbzPo6A4Y74qc=" - [mod."github.com/dgrijalva/jwt-go"] - version = "v3.2.0+incompatible" - hash = "sha256-t5rhczm+60rYmMg0mZTp86dJkzuGp/OLd5ccXek+oiI=" - [mod."github.com/distribution/reference"] - version = "v0.6.0" - hash = "sha256-gr4tL+qz4jKyAtl8LINcxMSanztdt+pybj1T+2ulQv4=" - [mod."github.com/docker/docker"] - version = "v27.5.0+incompatible" - hash = "sha256-D7/JqgMTZaHUX/lSZjD+3on/rt+HLBHY5d9Xp2HSzjE=" - [mod."github.com/docker/go-connections"] - version = "v0.5.0" - hash = "sha256-aGbMRrguh98DupIHgcpLkVUZpwycx1noQXbtTl5Sbms=" - [mod."github.com/docker/go-units"] - version = "v0.5.0" - hash = "sha256-iK/V/jJc+borzqMeqLY+38Qcts2KhywpsTk95++hImE=" - [mod."github.com/evanphx/json-patch/v5"] - version = "v5.9.0" - hash = "sha256-KG3giQTztHy6SX0wF2/Htje4MPs+1oEzfWhKDE0xl4U=" - [mod."github.com/fatih/color"] - version = "v1.18.0" - hash = "sha256-pP5y72FSbi4j/BjyVq/XbAOFjzNjMxZt2R/lFFxGWvY=" - [mod."github.com/felixge/httpsnoop"] - version = "v1.0.4" - hash = "sha256-c1JKoRSndwwOyOxq9ddCe+8qn7mG9uRq2o/822x5O/c=" - [mod."github.com/frankban/quicktest"] - version = "v1.14.3" - hash = "sha256-WCIb0lIRAaluIhKSUJNKpnNt4/mOII8/SwVXUeY9NWQ=" - [mod."github.com/go-jose/go-jose/v4"] - version = "v4.0.4" - hash = "sha256-847SAFF8Zo3QN0sl3G3MMARQKZxjotgJF2+5Fm7RFQ4=" - [mod."github.com/go-logr/logr"] - version = "v1.4.2" - hash = "sha256-/W6qGilFlZNTb9Uq48xGZ4IbsVeSwJiAMLw4wiNYHLI=" - [mod."github.com/go-logr/stdr"] - version = "v1.2.2" - hash = "sha256-rRweAP7XIb4egtT1f2gkz4sYOu7LDHmcJ5iNsJUd0sE=" - [mod."github.com/gogo/protobuf"] - version = "v1.3.2" - hash = "sha256-pogILFrrk+cAtb0ulqn9+gRZJ7sGnnLLdtqITvxvG6c=" - [mod."github.com/golang/protobuf"] - version = "v1.5.4" - hash = "sha256-N3+Lv9lEZjrdOWdQhFj6Y3Iap4rVLEQeI8/eFFyAMZ0=" - [mod."github.com/golang/snappy"] - version = "v0.0.4" - hash = "sha256-Umx+5xHAQCN/Gi4HbtMhnDCSPFAXSsjVbXd8n5LhjAA=" - [mod."github.com/google/go-cmp"] - version = "v0.6.0" - hash = "sha256-qgra5jze4iPGP0JSTVeY5qV5AvEnEu39LYAuUCIkMtg=" - [mod."github.com/google/go-github/v29"] - version = "v29.0.3" - hash = "sha256-erbjeiwv0GleiXrzSLIWMabYSyLNk+IqpZzE5b7fs7I=" - [mod."github.com/google/go-querystring"] - version = "v1.1.0" - hash = "sha256-itsKgKghuX26czU79cK6C2n+lc27jm5Dw1XbIRgwZJY=" - [mod."github.com/grpc-ecosystem/grpc-gateway/v2"] - version = "v2.25.1" - hash = "sha256-jo5rC4KOUjtnr2/me+DCICN4xP9BC6jenPM921YThJA=" - [mod."github.com/hashicorp/errwrap"] - version = "v1.1.0" - hash = "sha256-6lwuMQOfBq+McrViN3maJTIeh4f8jbEqvLy2c9FvvFw=" - [mod."github.com/hashicorp/go-cleanhttp"] - version = "v0.5.2" - hash = "sha256-N9GOKYo7tK6XQUFhvhImtL7PZW/mr4C4Manx/yPVvcQ=" - [mod."github.com/hashicorp/go-hclog"] - version = "v1.6.3" - hash = "sha256-BK2s+SH1tQyUaXCH4kC0/jgqiSu638UFbwamfKjFOYg=" - [mod."github.com/hashicorp/go-hmac-drbg"] - version = "v0.0.0-20210916214228-a6e5a68489f6" - hash = "sha256-DHfqnZM3IpZL1txiyBr3Qdz0S1Ozcr9aZuuaiqB9Po0=" - [mod."github.com/hashicorp/go-immutable-radix"] - version = "v1.3.1" - hash = "sha256-65+A2HiVfS/GV9G+6/TkXXjzXhI/V98e6RlJWjxy+mg=" - [mod."github.com/hashicorp/go-kms-wrapping/entropy/v2"] - version = "v2.0.1" - hash = "sha256-mRd2agoIcQHJvDVefzSaLeyIhSjeJEgBwifK7dpuMSk=" - [mod."github.com/hashicorp/go-kms-wrapping/v2"] - version = "v2.0.16" - hash = "sha256-G3la4dnjAxnHkMPGvMuX/GAEjQEfypDu667i+RvJjdI=" - [mod."github.com/hashicorp/go-multierror"] - version = "v1.1.1" - hash = "sha256-ANzPEUJIZIlToxR89Mn7Db73d9LGI51ssy7eNnUgmlA=" - [mod."github.com/hashicorp/go-plugin"] - version = "v1.6.2" - hash = "sha256-DaUb5lH/SQuKSI0jLOfbGBwnAJAsSJTU8am2PrYtFqw=" - [mod."github.com/hashicorp/go-retryablehttp"] - version = "v0.7.7" - hash = "sha256-XZjxncyLPwy6YBHR3DF5bEl1y72or0JDUncTIsb/eIU=" - [mod."github.com/hashicorp/go-rootcerts"] - version = "v1.0.2" - hash = "sha256-prifkrFs+lawGTig3GwxddR0QM9E1+IpgZWCKoOnS5M=" - [mod."github.com/hashicorp/go-secure-stdlib/cryptoutil"] - version = "v0.1.0" - hash = "sha256-1lrYBccpTRwjrWsm/LS8OYLmt0j/z86onqNjtu6LCi4=" - [mod."github.com/hashicorp/go-secure-stdlib/mlock"] - version = "v0.1.3" - hash = "sha256-QeFoNZzsC5wI/ZzWgswvJ4Cmi0/Rq3lNgdVi+ohmuIg=" - [mod."github.com/hashicorp/go-secure-stdlib/parseutil"] - version = "v0.1.9" - hash = "sha256-bVs3OcX3Dpx35RmMy4Tl7q5148U2l7zxnHC31yaBY78=" - [mod."github.com/hashicorp/go-secure-stdlib/plugincontainer"] - version = "v0.4.1" - hash = "sha256-dLarYybiz4uChJP+DWSHwNKA3gfrUbHETBqpRL+zfMU=" - [mod."github.com/hashicorp/go-secure-stdlib/strutil"] - version = "v0.1.2" - hash = "sha256-UmCMzjamCW1d9KNvNzELqKf1ElHOXPz+ZtdJkI+DV0A=" - [mod."github.com/hashicorp/go-sockaddr"] - version = "v1.0.7" - hash = "sha256-p6eDOrGzN1jMmT/F/f/VJMq0cKNFhUcEuVVwTE6vSrs=" - [mod."github.com/hashicorp/go-uuid"] - version = "v1.0.3" - hash = "sha256-8893qBbaug2yhxElowSrl3PrfhYlQ7cZ71QBgZWqpHE=" - [mod."github.com/hashicorp/go-version"] - version = "v1.7.0" - hash = "sha256-Umc/Q2mxRrPF4aEcDuDJq4lFBT+PSsnyANfyFwUIaxI=" - [mod."github.com/hashicorp/golang-lru"] - version = "v1.0.2" - hash = "sha256-yy+5botc6T5wXgOe2mfNXJP3wr+MkVlUZ2JBkmmrA48=" - [mod."github.com/hashicorp/hcl"] - version = "v1.0.1-vault-7" - hash = "sha256-xqYtjCJQVsg04Yj2Uy2Q5bi6X6cDRYhJD/SUEWaHMDM=" - [mod."github.com/hashicorp/vault/api"] - version = "v1.15.0" - hash = "sha256-7V/QU9TT+setRdTjS7vKL05wOEd4IEhSMVt9SJr/sQ4=" - [mod."github.com/hashicorp/vault/sdk"] - version = "v0.14.1" - hash = "sha256-XHFzRhg1asbg5U+Gppb6ZHgHDxSrBHBPcRc53hdLopE=" - [mod."github.com/hashicorp/yamux"] - version = "v0.1.2" - hash = "sha256-JvpgwhqKAaS0PSlU/obe4tDJ2LcR1pyWRmJTkmT7hrA=" - [mod."github.com/joshlf/go-acl"] - version = "v0.0.0-20200411065538-eae00ae38531" - hash = "sha256-aTzcESIjU/Oq5hzfV1b1VA1RVDDS/s1Qv/wm+wis7a8=" - [mod."github.com/mattn/go-colorable"] - version = "v0.1.14" - hash = "sha256-JC60PjKj7MvhZmUHTZ9p372FV72I9Mxvli3fivTbxuA=" - [mod."github.com/mattn/go-isatty"] - version = "v0.0.20" - hash = "sha256-qhw9hWtU5wnyFyuMbKx+7RB8ckQaFQ8D+8GKPkN3HHQ=" - [mod."github.com/mitchellh/copystructure"] - version = "v1.2.0" - hash = "sha256-VR9cPZvyW62IHXgmMw8ee+hBDThzd2vftgPksQYR/Mc=" - [mod."github.com/mitchellh/go-homedir"] - version = "v1.1.0" - hash = "sha256-oduBKXHAQG8X6aqLEpqZHs5DOKe84u6WkBwi4W6cv3k=" - [mod."github.com/mitchellh/mapstructure"] - version = "v1.5.0" - hash = "sha256-ztVhGQXs67MF8UadVvG72G3ly0ypQW0IRDdOOkjYwoE=" - [mod."github.com/mitchellh/reflectwalk"] - version = "v1.0.2" - hash = "sha256-VX9DPqChm7jPnyrA3RAYgxAFrAhj7TRKIWD/qR9Zr9s=" - [mod."github.com/moby/docker-image-spec"] - version = "v1.3.1" - hash = "sha256-xwSNLmMagzywdGJIuhrWl1r7cIWBYCOMNYbuDDT6Jhs=" - [mod."github.com/munnerz/goautoneg"] - version = "v0.0.0-20191010083416-a7dc8b61c822" - hash = "sha256-79URDDFenmGc9JZu+5AXHToMrtTREHb3BC84b/gym9Q=" - [mod."github.com/oklog/run"] - version = "v1.1.0" - hash = "sha256-U4IS0keJa4BSBSeEBqtIV1Zg6N4b0zFiKfzN9ua4pWQ=" - [mod."github.com/opencontainers/go-digest"] - version = "v1.0.0" - hash = "sha256-cfVDjHyWItmUGZ2dzQhCHgmOmou8v7N+itDkLZVkqkQ=" - [mod."github.com/opencontainers/image-spec"] - version = "v1.1.0" - hash = "sha256-5OxW1ShHypLpzVu+BJivNlFX2JFPh9WKfJcMIgPZf4U=" - [mod."github.com/petermattis/goid"] - version = "v0.0.0-20241211131331-93ee7e083c43" - hash = "sha256-Q/bdQtItqC/7xw7dEdnTlbyw5gu6706EZqCWgf+3seQ=" - [mod."github.com/pierrec/lz4"] - version = "v2.6.1+incompatible" - hash = "sha256-5+4i5SN97wG71knAF9eUgEEG5k03HW4wPnAdPd6JSfE=" - [mod."github.com/pkg/errors"] - version = "v0.9.1" - hash = "sha256-mNfQtcrQmu3sNg/7IwiieKWOgFQOVVe2yXgKBpe/wZw=" - [mod."github.com/pmezard/go-difflib"] - version = "v1.0.1-0.20181226105442-5d4384ee4fb2" - hash = "sha256-XA4Oj1gdmdV/F/+8kMI+DBxKPthZ768hbKsO3d9Gx90=" - [mod."github.com/prometheus/client_golang"] - version = "v1.20.5" - hash = "sha256-RbDZTBH+j2ZNLbHSMFxW0j8UStvkwc4IHTz3My9w4qo=" - [mod."github.com/prometheus/client_model"] - version = "v0.6.1" - hash = "sha256-rIDyUzNfxRA934PIoySR0EhuBbZVRK/25Jlc/r8WODw=" - [mod."github.com/prometheus/common"] - version = "v0.62.0" - hash = "sha256-UFccvzMJaBrUpnqVgZgohRcgk5SKMi/UJnXNtazCnx8=" - [mod."github.com/prometheus/procfs"] - version = "v0.15.1" - hash = "sha256-H+WXJemFFwdoglmD6p7JRjrJJZmIVAmJwYmLbZ8Q9sw=" - [mod."github.com/robfig/cron/v3"] - version = "v3.0.1" - hash = "sha256-FUdqNbWYi5biQc/tjCeqzxu4iy4ot1ZvDU1M1wRf/6k=" - [mod."github.com/ryanuber/go-glob"] - version = "v1.0.0" - hash = "sha256-YkMl1utwUhi3E0sHK23ISpAsPyj4+KeXyXKoFYGXGVY=" - [mod."github.com/sasha-s/go-deadlock"] - version = "v0.3.5" - hash = "sha256-1vyxWqOTVVVeodipm/tpDgRKUMkEdkoLWSgtiVZaZmw=" - [mod."github.com/stretchr/testify"] - version = "v1.10.0" - hash = "sha256-fJ4gnPr0vnrOhjQYQwJ3ARDKPsOtA7d4olQmQWR+wpI=" - [mod."go.opentelemetry.io/auto/sdk"] - version = "v1.1.0" - hash = "sha256-cA9qCCu8P1NSJRxgmpfkfa5rKyn9X+Y/9FSmSd5xjyo=" - [mod."go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"] - version = "v0.59.0" - hash = "sha256-zeC30S2MV7W2xxS5rVfPGhZO4jcdPpxxfy3QvBkt/pQ=" - [mod."go.opentelemetry.io/otel"] - version = "v1.34.0" - hash = "sha256-hnuuTSxaf9yMO/23xWdcTGNzvnnJiqUiL4nzYwUV5bc=" - [mod."go.opentelemetry.io/otel/metric"] - version = "v1.34.0" - hash = "sha256-JklGKJiMf1fpsE9pmnuLUq26g6wVp173v4GWJ7Xp5s4=" - [mod."go.opentelemetry.io/otel/trace"] - version = "v1.34.0" - hash = "sha256-u11KJ4WTDtcb0tVv7d/HOdhq8Ea+c1QPBO8MbsCQu9Q=" - [mod."go.uber.org/atomic"] - version = "v1.11.0" - hash = "sha256-TyYws/cSPVqYNffFX0gbDml1bD4bBGcysrUWU7mHPIY=" - [mod."golang.org/x/crypto"] - version = "v0.32.0" - hash = "sha256-4l8XyVfpunL7d03otqfx3ouG3qkSF+LT7VuH1K3oo2I=" - [mod."golang.org/x/net"] - version = "v0.34.0" - hash = "sha256-AZOLY4MUNxxDw5ZQtO9dmY/YRo1gFW87YvpX/eLTy4Q=" - [mod."golang.org/x/sys"] - version = "v0.29.0" - hash = "sha256-qfsodJQ1H1CBI8yQWOvsXJgY5qHmiuw566HrrIseYHI=" - [mod."golang.org/x/text"] - version = "v0.21.0" - hash = "sha256-QaMwddBRnoS2mv9Y86eVC2x2wx/GZ7kr2zAJvwDeCPc=" - [mod."golang.org/x/time"] - version = "v0.9.0" - hash = "sha256-ipaWVIk1+DZg0rfCzBSkz/Y6DEnB7xkX2RRYycHkhC0=" - [mod."google.golang.org/genproto/googleapis/rpc"] - version = "v0.0.0-20250115164207-1a7da9e5054f" - hash = "sha256-jAXIoaWIioRijaSS58n+ydbshsc9UWsLSsHVBn288r4=" - [mod."google.golang.org/grpc"] - version = "v1.69.4" - hash = "sha256-3CajnPRah0mK7Nx4ygROl743TK88LJWyOajPWwLvXzo=" - [mod."google.golang.org/protobuf"] - version = "v1.36.3" - hash = "sha256-QiGdbPTfQD7U2IaKq7CAN8S4YmQ2A2HB9dBcqhpwXA4=" - [mod."gopkg.in/yaml.v3"] - version = "v3.0.1" - hash = "sha256-FqL9TKYJ0XkNwJFnq9j0VvJ5ZUU1RvH/52h/f5bkYAU=" - [mod."gotest.tools"] - version = "v2.2.0+incompatible" - hash = "sha256-BYTGCeD1GH0nUMxaP1ARTpfGk3vQroDNAgb3LYKhon4="