Skip to content

Commit 1284a20

Browse files
authored
chore: update dependencies (#17)
Update dependencies, workflows and Go version.
1 parent 49d6dd3 commit 1284a20

File tree

10 files changed

+186
-160
lines changed

10 files changed

+186
-160
lines changed

.github/workflows/lint.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ jobs:
2424
runs-on: ubuntu-latest
2525
steps:
2626
- name: Checkout Repo 🛎
27-
uses: actions/checkout@v4
27+
uses: actions/checkout@v5
2828
with:
2929
fetch-depth: 0
3030

3131
- name: Lint Code Base 🕵🏻‍♀️
32-
uses: super-linter/super-linter@v7
32+
uses: super-linter/super-linter/slim@v8
3333
env:
3434
LINTER_RULES_PATH: /
3535
VALIDATE_ALL_CODEBASE: false
@@ -47,20 +47,20 @@ jobs:
4747
strategy:
4848
matrix:
4949
go-version:
50-
- 1.23.6
50+
- 1.24.7
5151
steps:
5252
- name: Checkout Repo 🛎
53-
uses: actions/checkout@v4
53+
uses: actions/checkout@v5
5454

5555
- name: Setup Go 🐹
56-
uses: actions/setup-go@v5
56+
uses: actions/setup-go@v6
5757
with:
5858
go-version: ${{ matrix.go-version }}
5959
cache: true
6060
cache-dependency-path: go.sum
6161

6262
- name: Lint Go Code 🕵🏻‍♂️
63-
uses: golangci/golangci-lint-action@v6
63+
uses: golangci/golangci-lint-action@v8
6464
with:
6565
version: latest
6666
only-new-issues: false

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ jobs:
2727
runs-on: ubuntu-latest
2828
steps:
2929
- name: Checkout Repo 🛎
30-
uses: actions/checkout@v4
30+
uses: actions/checkout@v5
3131
with:
3232
fetch-depth: 0
3333

3434
- name: Setup Go 🐹
35-
uses: actions/setup-go@v5
35+
uses: actions/setup-go@v6
3636
with:
37-
go-version: 1.23.6
37+
go-version: 1.24.7
3838
cache: true
3939
cache-dependency-path: go.sum
4040

.github/workflows/test.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,16 @@ jobs:
2525
strategy:
2626
matrix:
2727
go-version:
28-
- 1.23.6
28+
- 1.24.7
2929
defaults:
3030
run:
3131
shell: bash
3232
steps:
3333
- name: Checkout Repo 🛎
34-
uses: actions/checkout@v4
34+
uses: actions/checkout@v5
3535

3636
- name: Setup Go 🐹
37-
uses: actions/setup-go@v5
37+
uses: actions/setup-go@v6
3838
with:
3939
go-version: ${{ matrix.go-version }}
4040
cache: true
@@ -92,14 +92,14 @@ jobs:
9292
strategy:
9393
matrix:
9494
go-version:
95-
- 1.23.6
95+
- 1.24.7
9696
runs-on: ubuntu-latest
9797
steps:
9898
- name: Checkout Repo 🛎
99-
uses: actions/checkout@v4
99+
uses: actions/checkout@v5
100100

101101
- name: Setup Go 🐹
102-
uses: actions/setup-go@v5
102+
uses: actions/setup-go@v6
103103
with:
104104
go-version: ${{ matrix.go-version }}
105105
cache: true

.golangci.yml

Lines changed: 39 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,44 @@
1-
# See https://github.com/golangci/golangci-lint/blob/master/.golangci.example.yml
2-
issues:
3-
exclude-rules:
4-
- path: _test\.go
5-
linters:
6-
- dupl
7-
- gosec
8-
- goconst
1+
version: "2"
92
linters:
103
enable:
11-
- gosec
12-
- unconvert
13-
- gocyclo
144
- goconst
15-
- goimports
165
- gocritic
17-
- govet
6+
- gocyclo
7+
- gosec
8+
- lll
189
- revive
19-
linters-settings:
20-
errcheck:
21-
# report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`;
22-
# default is false: such cases aren't reported by default.
23-
check-blank: true
24-
govet:
25-
enable:
26-
- shadow
27-
gocyclo:
28-
# minimal code complexity to report, 30 by default
29-
min-complexity: 15
30-
maligned:
31-
# print struct with more effective memory layout or not, false by default
32-
suggest-new: true
10+
- unconvert
11+
settings:
12+
errcheck:
13+
check-blank: true
14+
gocyclo:
15+
min-complexity: 15
16+
lll:
17+
line-length: 120
18+
19+
exclusions:
20+
generated: lax
21+
presets:
22+
- comments
23+
- common-false-positives
24+
- legacy
25+
- std-error-handling
26+
rules:
27+
- linters:
28+
- dupl
29+
- goconst
30+
- gosec
31+
path: _test\.go
32+
paths:
33+
- third_party$
34+
- builtin$
35+
- examples$
36+
formatters:
37+
enable:
38+
- goimports
39+
exclusions:
40+
generated: lax
41+
paths:
42+
- third_party$
43+
- builtin$
44+
- examples$

.goreleaser.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Customization options: https://goreleaser.com/customization/
2+
version: 2
23
project_name: git-synchronizer
34
before:
45
hooks:
@@ -38,3 +39,16 @@ dockers:
3839
- "--label=org.opencontainers.image.version={{ .Version }}"
3940
- "--build-arg=PROJECT_NAME={{ .ProjectName }}"
4041
- "--platform=linux/amd64"
42+
43+
# Update to this config in the future.
44+
# dockers_v2:
45+
# - images:
46+
# - "ghcr.io/insightsengineering/{{ .ProjectName }}"
47+
# tags:
48+
# - "latest"
49+
# - "{{ .Version }}"
50+
# labels:
51+
# "org.opencontainers.image.created": "{{ .Date }}"
52+
# "org.opencontainers.image.title": "{{ .ProjectName }}"
53+
# "org.opencontainers.image.revision": "{{ .FullCommit }}"
54+
# "org.opencontainers.image.version": "{{ .Version }}"

Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
FROM scratch
22
ARG PROJECT_NAME="git-synchronizer"
3+
# Uncomment when goreleaser config is updated to dockers_v2.
4+
# ARG TARGETPLATFORM
35
ENV PROJECT_NAME=${PROJECT_NAME}
46
COPY ${PROJECT_NAME} /
7+
# Change to this when goreleaser config is updated to dockers_v2.
8+
# COPY $TARGETPLATFORM/${PROJECT_NAME} /
59
WORKDIR /
610
# hadolint ignore=DL3025
711
ENTRYPOINT ${PROJECT_NAME}

Makefile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ help: ## Show this help menu
2525

2626
devdeps: ## Install development dependencies
2727
@printf "Executing target: [$@] 🎯\n"
28-
@which -a golangci-lint > /dev/null || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH) v1.51.2
28+
@which -a golangci-lint > /dev/null || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH) v2.5.0
2929
@which -a typex > /dev/null || go install github.com/dtgorski/typex@latest
30-
@which -a goreleaser > /dev/null || go install github.com/goreleaser/goreleaser@latest
30+
@# Goreleaser v2.12 requires Go 1.25, so pin to v2.11.2 for now
31+
@which -a goreleaser > /dev/null || go install github.com/goreleaser/goreleaser/v2@v2.11.2
3132
@which -a gocover-cobertura > /dev/null || go install github.com/boumenot/gocover-cobertura@latest
3233
@which -a misspell > /dev/null || go install github.com/client9/misspell/cmd/misspell@latest
3334
@which -a gotestdox > /dev/null || go install github.com/bitfield/gotestdox/cmd/gotestdox@latest
@@ -60,7 +61,7 @@ format: ## Format source code
6061

6162
lint: devdeps spell ## Lint source code
6263
@printf "Executing target: [$@] 🎯\n"
63-
@golangci-lint run --fast -c .golangci.yml
64+
@golangci-lint run -c .golangci.yml
6465

6566
test: clean tidy devdeps spell ## Run unit tests and generate reports
6667
@printf "Executing target: [$@] 🎯\n"

cmd/mirror.go

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ func ListRemote(remote *git.Remote, listOptions *git.ListOptions, repository str
9999
}
100100

101101
// GetBranchesAndTagsFromRemote returns list of branches and tags present in remoteName of repository.
102-
func GetBranchesAndTagsFromRemote(repository *git.Repository, remoteName string, listOptions *git.ListOptions, sourceRepository string) ([]string, []string, error) {
102+
func GetBranchesAndTagsFromRemote(repository *git.Repository, remoteName string, listOptions *git.ListOptions,
103+
sourceRepository string) ([]string, []string, error) {
103104
var branchList []string
104105
var tagList []string
105106
var err error
@@ -229,7 +230,8 @@ func GetDestinationAuth(destAuth Authentication) *githttp.BasicAuth {
229230
}
230231

231232
// GitPlainClone clones git repository and is retried in case of error.
232-
func GitPlainClone(gitDirectory string, cloneOptions *git.CloneOptions, repositoryName string) (*git.Repository, error) {
233+
func GitPlainClone(gitDirectory string, cloneOptions *git.CloneOptions,
234+
repositoryName string) (*git.Repository, error) {
233235
repository, err := git.PlainClone(gitDirectory, false, cloneOptions)
234236
if err == gittransport.ErrAuthenticationRequired {
235237
// Terminate backoff.
@@ -279,7 +281,8 @@ func PushRefs(repository *git.Repository, auth *githttp.BasicAuth, refSpecString
279281

280282
// MirrorRepository mirrors branches and tags from source to destination. Tags and branches
281283
// no longer present in source are removed from destination.
282-
func MirrorRepository(messages chan MirrorStatus, source, destination string, sourceAuthentication, destinationAuthentication Authentication) {
284+
func MirrorRepository(messages chan MirrorStatus, source, destination string,
285+
sourceAuthentication, destinationAuthentication Authentication) {
283286
log.Debug("Cloning ", source)
284287
cloneStart := time.Now()
285288
gitDirectory, err := os.MkdirTemp(localTempDirectory, "")
@@ -345,7 +348,9 @@ func MirrorRepository(messages chan MirrorStatus, source, destination string, so
345348

346349
destinationAuth := GetDestinationAuth(destinationAuthentication)
347350

348-
destinationBranchList, destinationTagList, err := GetBranchesAndTagsFromRemote(repository, "destination", &git.ListOptions{Auth: destinationAuth}, destination)
351+
destinationBranchList, destinationTagList, err := GetBranchesAndTagsFromRemote(
352+
repository, "destination", &git.ListOptions{Auth: destinationAuth}, destination,
353+
)
349354
if err != nil {
350355
ProcessError(err, "getting branches and tags from ", destination, &allErrors)
351356
}
@@ -359,7 +364,9 @@ func MirrorRepository(messages chan MirrorStatus, source, destination string, so
359364
pushBranchesBackoff.MaxElapsedTime = 2 * time.Minute
360365
err = backoff.Retry(
361366
func() error {
362-
return PushRefs(repository, destinationAuth, "+"+refBranchPrefix+branch+":"+refBranchPrefix+branch, destination)
367+
return PushRefs(
368+
repository, destinationAuth, "+"+refBranchPrefix+branch+":"+refBranchPrefix+branch, destination,
369+
)
363370
},
364371
pushBranchesBackoff,
365372
)

go.mod

Lines changed: 30 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,74 @@
11
module github.com/insightsengineering/git-synchronizer
22

3-
go 1.23.0
4-
5-
toolchain go1.23.6
3+
go 1.24.7
64

75
require (
86
github.com/cenkalti/backoff/v4 v4.3.0
9-
github.com/go-git/go-git/v5 v5.13.2
7+
github.com/go-git/go-git/v5 v5.16.2
108
github.com/jamiealquiza/envy v1.1.0
119
github.com/sirupsen/logrus v1.9.3
12-
github.com/spf13/cobra v1.8.1
13-
github.com/spf13/viper v1.19.0
14-
github.com/stretchr/testify v1.10.0
10+
github.com/spf13/cobra v1.10.1
11+
github.com/spf13/viper v1.21.0
12+
github.com/stretchr/testify v1.11.1
1513
go.szostok.io/version v1.2.0
1614
)
1715

1816
require (
19-
dario.cat/mergo v1.0.1 // indirect
17+
dario.cat/mergo v1.0.2 // indirect
2018
github.com/Masterminds/goutils v1.1.1 // indirect
21-
github.com/Masterminds/semver/v3 v3.3.1 // indirect
19+
github.com/Masterminds/semver/v3 v3.4.0 // indirect
2220
github.com/Masterminds/sprig/v3 v3.3.0 // indirect
2321
github.com/Microsoft/go-winio v0.6.2 // indirect
24-
github.com/ProtonMail/go-crypto v1.1.5 // indirect
22+
github.com/ProtonMail/go-crypto v1.3.0 // indirect
2523
github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de // indirect
2624
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
25+
github.com/clipperhouse/uax29/v2 v2.2.0 // indirect
2726
github.com/cloudflare/circl v1.6.1 // indirect
28-
github.com/cyphar/filepath-securejoin v0.4.1 // indirect
27+
github.com/cyphar/filepath-securejoin v0.5.0 // indirect
2928
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
3029
github.com/dustin/go-humanize v1.0.1 // indirect
3130
github.com/emirpasic/gods v1.18.1 // indirect
3231
github.com/fatih/color v1.18.0 // indirect
33-
github.com/fsnotify/fsnotify v1.8.0 // indirect
32+
github.com/fsnotify/fsnotify v1.9.0 // indirect
3433
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
3534
github.com/go-git/go-billy/v5 v5.6.2 // indirect
36-
github.com/goccy/go-yaml v1.15.17 // indirect
35+
github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
36+
github.com/goccy/go-yaml v1.18.0 // indirect
3737
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect
3838
github.com/google/uuid v1.6.0 // indirect
3939
github.com/hashicorp/go-version v1.7.0 // indirect
40-
github.com/hashicorp/hcl v1.0.0 // indirect
4140
github.com/hokaccha/go-prettyjson v0.0.0-20211117102719-0474bc63780f // indirect
4241
github.com/huandu/xstrings v1.5.0 // indirect
4342
github.com/inconshreveable/mousetrap v1.1.0 // indirect
4443
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
45-
github.com/kevinburke/ssh_config v1.2.0 // indirect
46-
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
47-
github.com/magiconair/properties v1.8.9 // indirect
44+
github.com/kevinburke/ssh_config v1.4.0 // indirect
45+
github.com/klauspost/cpuid/v2 v2.3.0 // indirect
46+
github.com/lucasb-eyer/go-colorful v1.3.0 // indirect
4847
github.com/mattn/go-colorable v0.1.14 // indirect
4948
github.com/mattn/go-isatty v0.0.20 // indirect
50-
github.com/mattn/go-runewidth v0.0.16 // indirect
49+
github.com/mattn/go-runewidth v0.0.19 // indirect
5150
github.com/mitchellh/copystructure v1.2.0 // indirect
52-
github.com/mitchellh/mapstructure v1.5.0 // indirect
5351
github.com/mitchellh/reflectwalk v1.0.2 // indirect
54-
github.com/muesli/termenv v0.15.2 // indirect
55-
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
56-
github.com/pjbgf/sha1cd v0.3.2 // indirect
52+
github.com/muesli/termenv v0.16.0 // indirect
53+
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
54+
github.com/pjbgf/sha1cd v0.5.0 // indirect
5755
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
5856
github.com/rivo/uniseg v0.4.7 // indirect
59-
github.com/sagikazarmark/locafero v0.7.0 // indirect
60-
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
61-
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect
57+
github.com/sagikazarmark/locafero v0.12.0 // indirect
58+
github.com/sergi/go-diff v1.4.0 // indirect
6259
github.com/shopspring/decimal v1.4.0 // indirect
6360
github.com/skeema/knownhosts v1.3.1 // indirect
64-
github.com/sourcegraph/conc v0.3.0 // indirect
65-
github.com/spf13/afero v1.12.0 // indirect
66-
github.com/spf13/cast v1.7.1 // indirect
67-
github.com/spf13/pflag v1.0.6 // indirect
61+
github.com/spf13/afero v1.15.0 // indirect
62+
github.com/spf13/cast v1.10.0 // indirect
63+
github.com/spf13/pflag v1.0.10 // indirect
6864
github.com/subosito/gotenv v1.6.0 // indirect
6965
github.com/xanzy/ssh-agent v0.3.3 // indirect
70-
go.uber.org/multierr v1.11.0 // indirect
71-
golang.org/x/crypto v0.36.0 // indirect
66+
go.yaml.in/yaml/v3 v3.0.4 // indirect
67+
golang.org/x/crypto v0.42.0 // indirect
7268
golang.org/x/exp v0.0.0-20250128182459-e0ece0dbea4c // indirect
73-
golang.org/x/net v0.38.0 // indirect
74-
golang.org/x/sys v0.31.0 // indirect
75-
golang.org/x/text v0.23.0 // indirect
76-
gopkg.in/ini.v1 v1.67.0 // indirect
69+
golang.org/x/net v0.44.0 // indirect
70+
golang.org/x/sys v0.36.0 // indirect
71+
golang.org/x/text v0.29.0 // indirect
7772
gopkg.in/warnings.v0 v0.1.2 // indirect
7873
gopkg.in/yaml.v3 v3.0.1 // indirect
7974
)

0 commit comments

Comments
 (0)