Skip to content

Commit

Permalink
Fix goreleaser version (#667)
Browse files Browse the repository at this point in the history
The release github action is currently broken:

We were using the `latest` gorelease-action, which had changed from 1->2 recently. The main breaking change for us was that `--rm-dist` flag was replaced by `--clean`

But this change causes some other changes:
- Some smaller changes in the goreleaser config
- To run the newest goreleaser, we have to upgrade to golang 1.23.0
- When using go 1.23.0, golangci-lint also needs upgrading
- golanci-lint on the new version also has some config deprecations/changes 

But with all these changes, the local build/lint runs without errors or warnings and the dry-run gorelease also runs through (hopefully the same is the case in the github action).
  • Loading branch information
gigerdo authored Sep 27, 2024
1 parent 2a3754f commit abe3883
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 27 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.20"
go-version: "1.23"
id: go

- name: Bump patch version
Expand Down Expand Up @@ -60,7 +60,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.20"
go-version: "1.23"
id: go

- name: Bump main version
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.20"
go-version: "1.23"
id: go

- name: Check out code into the Go module directory
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.20"
go-version: "1.23"
id: go

- name: Cache Go Modules
Expand Down Expand Up @@ -62,8 +62,8 @@ jobs:
OWNER: elastic
REPO: ecctl
with:
version: latest
args: release --rm-dist
version: '~> v2'
args: release --clean

- name: Run release post actions
run: ./scripts/goreleaser-post-actions.sh $VERSION
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ vendor
dist
reports
.idea/
html_docs/
html_docs/
ecctl.iml
15 changes: 12 additions & 3 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,21 @@ linters:
- lll
- gochecknoglobals
- gochecknoinits
- scopelint
- funlen
- wsl
- gomnd

linters-settings:
errcheck:
exclude: build/errcheck-exclusions.txt
exclude-functions:
- (*github.com/spf13/cobra.Command).MarkFlagRequired
- (*github.com/spf13/cobra.Command).MarkFlagFilename
- github.com/spf13/cobra.MarkFlagRequired
- github.com/spf13/cobra.MarkFlagFilename
- github.com/spf13/cobra.MarkFlagFilename
- (*github.com/spf13/cobra.Command).Help
- (*github.com/spf13/viper.Viper).BindPFlags
- (*github.com/spf13/pflag.FlagSet).MarkHidden
govet:
check-shadowing: false

Expand Down Expand Up @@ -64,4 +71,6 @@ issues:


output:
format: tab
formats:
- format: tab
path: stderr
3 changes: 2 additions & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
version: 2
project_name: ecctl
before:
hooks:
Expand Down Expand Up @@ -34,7 +35,7 @@ archives:
- README*
- docs/*
snapshot:
name_template: "{{ .Version }}_SNAPSHOT_{{ .ShortCommit }}"
version_template: "{{ .Version }}_SNAPSHOT_{{ .ShortCommit }}"
nfpms:
- file_name_template: >-
{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_
Expand Down
2 changes: 1 addition & 1 deletion build/Makefile.build
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ changelog:

## Generates a snapshot of the potential release
snapshot: deps
@ $(GOBIN)/goreleaser release --rm-dist --snapshot --skip-validate
@ $(GOBIN)/goreleaser release --clean --snapshot --skip-validate
8 changes: 4 additions & 4 deletions build/Makefile.deps
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ VERSION_DIR:=$(GOBIN)/versions

VERSION_GOLICENSER:=v0.4.1
VERSION_GOLICENCEDETECTOR:=v0.6.0
VERSION_GOLANGCILINT:=v1.54.2
VERSION_GOLANGCILINT:=v1.61.0
VERSION_GOBINDATA:=v0.0.0-20190711162640-ee3c2418e368
VERSION_GORELEASER:=v1.21.2
VERSION_GORELEASER:=v2.3.2
VERSION_VERSIONBUMP:=v1.1.0

deps: $(GOBIN)/go-licenser $(GOBIN)/go-licence-detector $(GOBIN)/golangci-lint $(GOBIN)/go-bindata
deps: $(GOBIN)/go-licenser $(GOBIN)/go-licence-detector $(GOBIN)/golangci-lint $(GOBIN)/go-bindata $(GOBIN)/goreleaser

$(GOBIN):
@ mkdir -p $(GOBIN)
Expand Down Expand Up @@ -57,7 +57,7 @@ $(VERSION_DIR)/.version-goreleaser-$(VERSION_GORELEASER): | $(VERSION_DIR)

$(GOBIN)/goreleaser: $(VERSION_DIR)/.version-goreleaser-$(VERSION_GORELEASER) | $(GOBIN)
@ echo "-> Installing goreleaser..."
@ go install github.com/goreleaser/goreleaser@$(VERSION_GORELEASER)
@ go install github.com/goreleaser/goreleaser/v2@$(VERSION_GORELEASER)

$(VERSION_DIR)/.version-versionbump-$(VERSION_VERSIONBUMP): | $(VERSION_DIR)
@ rm -f $(VERSION_DIR)/.version-versionbump-*
Expand Down
4 changes: 2 additions & 2 deletions build/Makefile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ _bindata:
format: deps
@ echo "-> Formatting Go files..."
@ $(GOBIN)/go-licenser -license ASL2
@ $(GOBIN)/golangci-lint run --fix --deadline=5m
@ $(GOBIN)/golangci-lint run --fix --timeout 5m
@ echo "-> Done."

## Generates the notice file
Expand All @@ -55,7 +55,7 @@ notice: deps
.PHONY: lint
lint: deps
@ echo "-> Running linters..."
@ $(GOBIN)/golangci-lint run --deadline=5m
@ $(GOBIN)/golangci-lint run --timeout 5m
@ $(GOBIN)/go-licenser -d .
@ echo "-> Done."

Expand Down
8 changes: 0 additions & 8 deletions build/errcheck-exclusions.txt

This file was deleted.

2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/elastic/ecctl

go 1.20
go 1.23

require (
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2
Expand Down
5 changes: 5 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDD
github.com/elastic/cloud-sdk-go v1.22.0 h1:sPjvu7zZeDbgl6eufy41VH0TjWbaMgDS+Cy9qIvdFZ4=
github.com/elastic/cloud-sdk-go v1.22.0/go.mod h1:k0ZebhZKX22l6Ysl5Zbpc8VLF54hfwDtHppEEEVUJ04=
github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=
github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM=
github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
Expand Down Expand Up @@ -167,9 +168,11 @@ github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5a
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4=
github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
Expand All @@ -194,6 +197,7 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxv
github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
Expand Down Expand Up @@ -241,6 +245,7 @@ github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR
github.com/rogpeppe/go-internal v1.2.2/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ=
Expand Down

0 comments on commit abe3883

Please sign in to comment.