Skip to content

Commit

Permalink
Bump all go.mod in the updater script
Browse files Browse the repository at this point in the history
Resolves GH-705

I will test the actual behavior with triggering the workflow after this commit
  • Loading branch information
kachick committed Sep 18, 2024
1 parent 7a20d2d commit 19a6558
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/update-flake-lock-and-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ jobs:
pr-title: 'Bump flake.lock and related dependencies'
optional-run: |
nix run .#bump_completions
nix run .#bump_gomod
nix run .#bump_gomod -- . pkgs/trim-github-user-prefix-for-reponame
secrets:
APP_PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
9 changes: 7 additions & 2 deletions pkgs/bump_gomod/bump_gomod.bash
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
go get "go@$(go version | grep -oP '(?<=go)\d\S+')"
# `modRoot` in buildGoModule did not fit for this purpose
# https://github.com/NixOS/nixpkgs/blob/086b448a5d54fd117f4dc2dee55c9f0ff461bdc1/pkgs/build-support/go/module.nix#L12-L13
for dir in "$@"; do
cd "$dir" || exit
go get "go@$(go version | grep -oP '(?<=go)\d\S+')"
done

git add go.mod go.sum

This comment has been minimized.

Copy link
@kachick

kachick Sep 18, 2024

Author Owner

Accidentally omitted go.sum, but I guess this still works 🤔

This comment has been minimized.

Copy link
@kachick

kachick Sep 18, 2024

Author Owner

And the go.sum updating is done by dependabot/renovatebot

This comment has been minimized.

Copy link
@kachick

kachick Sep 18, 2024

Author Owner

https://github.com/kachick/dotfiles/actions/runs/10927165782/job/30332700530

building '/nix/store/sw6abbvnds9456wzyg57zl3k2wgilx8c-bump_completions.drv'...
this derivation will be built:
  /nix/store/fmwjlaxhif9wjdlwksdafk9ac9g9f9gc-bump_gomod.drv
building '/nix/store/fmwjlaxhif9wjdlwksdafk9ac9g9f9gc-bump_gomod.drv'...
go: upgraded go 1.22.3 => 1.22.6
error: pathspec 'go.sum' did not match any file(s) known to git
Error: Process completed with exit code 1.

failed 😋

This comment has been minimized.

Copy link
@kachick

kachick Sep 18, 2024

Author Owner

Fixed in 1fc26ab => #797

git ls-files '**go.mod' | xargs git add
git update-index -q --really-refresh
git diff-index --quiet HEAD || git commit -m 'Update go.mod' go.mod go.sum
1 change: 1 addition & 0 deletions pkgs/bump_gomod/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ pkgs.writeShellApplication rec {
git
go
gnugrep
findutils # `xargs`
];
meta = {
description = "Update go.mod with method of https://github.com/kachick/times_kachick/issues/265";
Expand Down

0 comments on commit 19a6558

Please sign in to comment.