Skip to content

Commit

Permalink
Merge pull request #318 from mondragonfx/go-v1.23
Browse files Browse the repository at this point in the history
Update go to v1.23
  • Loading branch information
happytreees authored Sep 26, 2024
2 parents c3f2d2c + 34a7b44 commit 78beabe
Show file tree
Hide file tree
Showing 11 changed files with 338 additions and 426 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/gochecks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v2
uses: actions/setup-go@v5
with:
go-version: "1.20"
go-version: "1.23"

- name: Install dependencies
run: |
go version
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.52.2
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.61.0
- name: Run golangci-lint
run: |
Expand All @@ -27,11 +27,11 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v2
uses: actions/setup-go@v5
with:
go-version: "1.20"
go-version: "1.23"

- name: Run fmt
run: |
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/nightly-acceptance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ jobs:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '^1.20'
go-version: '^1.23'
- run: make test
env:
PACKER_ACC: ${{ secrets.PACKER_ACC }}
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/notify-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ jobs:
runs-on: ubuntu-latest
name: Pull Request Notification
steps:
- run: |
echo "{\"text\":\"Packer: PR https://github.com/vultr/packer-builder-vultr/pull/${{ github.event.number }} \"}" > mattermost.json
- uses: mattermost/action-mattermost-notify@2.0.0
- name: Send Notification to Mattermost
uses: mattermost/action-mattermost-notify@2.0.0
with:
MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK_URL }}
MATTERMOST_USERNAME: ${{ secrets.MATTERMOST_USERNAME}}
MATTERMOST_ICON: ${{ secrets.MATTERMOST_ICON }}
MATTERMOST_USERNAME: ${{ secrets.MATTERMOST_USERNAME }}
MATTERMOST_ICON_URL: ${{ secrets.MATTERMOST_ICON }}
TEXT: "${{ github.repository }} : PR https://github.com/${{ github.repository }}/pull/${{ github.event.number }}"
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
outputs:
new_tag: ${{ steps.tagger.outputs.new_tag }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: '0'

Expand All @@ -45,13 +45,13 @@ jobs:
needs: create-tag
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Unshallow
run: git fetch --prune --unshallow
- name: Set up Go
uses: actions/setup-go@v2
uses: actions/setup-go@v5
with:
go-version: "1.20"
go-version: "1.23"
- name: Describe plugin
id: plugin_describe
run: echo "::set-output name=api_version::$(go run . describe | jq -r '.api_version')"
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ jobs:
runs-on: ubuntu-latest
steps:

- name: Set up Go 1.20
uses: actions/setup-go@v1
- name: Set up Go 1.23
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
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Build
run: make test
env:
Expand Down
28 changes: 12 additions & 16 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
linters-settings:
depguard:
list-type: denylist
packages:
# logging is allowed only by logutils.Log, logrus
# is allowed to use only in logutils package
- github.com/sirupsen/logrus
packages-with-error-message:
- github.com/sirupsen/logrus: "logging is allowed only by logutils.Log"
dupl:
threshold: 100
funlen:
Expand All @@ -31,7 +23,7 @@ linters-settings:
min-complexity: 15
goimports:
local-prefixes: github.com/golangci/golangci-lint
gomnd:
mnd:
# don't include the "operation" and "assign"
checks:
- argument
Expand All @@ -47,7 +39,9 @@ linters-settings:
- strings.SplitN

govet:
check-shadowing: true
enable-all: true
disable:
- fieldalignment # a lot of manual overhead for reduced readability and adding a linter "gotcha"
settings:
printf:
funcs:
Expand All @@ -71,27 +65,25 @@ linters-settings:
linters:
disable-all: true
enable:
- bodyclose
- depguard
- copyloopvar
- dogsled
- dupl
- errcheck
- exportloopref
- funlen
- gochecknoinits
- goconst
- gocritic
- gocyclo
- gofmt
- goimports
- gomnd
- goprintffuncname
- gosec
- gosimple
- govet
- ineffassign
- lll
- misspell
- mnd
- nakedret
- noctx
- nolintlint
Expand All @@ -105,6 +97,8 @@ linters:
- whitespace

# don't enable:
# - bodyclose
# - depguard
# - asciicheck
# - scopelint
# - gochecknoglobals
Expand Down Expand Up @@ -137,6 +131,8 @@ issues:
- errcheck
- dupl
- gosec

- lll
- goconst
- dogsled
run:
timeout: 5m
timeout: 5m
6 changes: 5 additions & 1 deletion builder/vultr/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ import (
"github.com/hashicorp/packer-plugin-sdk/template/interpolate"
)

const (
defaultStateTimeout = 10 * time.Minute
)

// Config provides the config struct
type Config struct {
common.PackerConfig `mapstructure:",squash"`
Expand Down Expand Up @@ -121,7 +125,7 @@ func (c *Config) Prepare(raws ...interface{}) error { //nolint:gocyclo
}

if c.RawStateTimeout == "" {
c.stateTimeout = 10 * time.Minute
c.stateTimeout = defaultStateTimeout
} else {
if stateTimeout, err := time.ParseDuration(c.RawStateTimeout); err == nil {
c.stateTimeout = stateTimeout
Expand Down
2 changes: 1 addition & 1 deletion builder/vultr/step_create_iso.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func (s *stepCreateISO) Run(ctx context.Context, state multistep.StateBag) multi
c := state.Get("config").(*Config)
ui := state.Get("ui").(packer.Ui)

if len(c.ISOURL) > 0 {
if c.ISOURL != "" {
ui.Say("Creating ISO in Vultr account...")

isoReq := &govultr.ISOReq{
Expand Down
11 changes: 8 additions & 3 deletions builder/vultr/wait.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ import (
"github.com/vultr/govultr/v3"
)

const (
sleepDurationSeconds = 3
stateTimeoutMinutes = 10
)

func waitForISOState(state, isoID string, client *govultr.Client, timeout time.Duration) error { //nolint:dupl
done := make(chan struct{})
defer close(done)
Expand All @@ -30,7 +35,7 @@ func waitForISOState(state, isoID string, client *govultr.Client, timeout time.D
return
}

time.Sleep(3 * time.Second)
time.Sleep(sleepDurationSeconds * time.Second)

select {
case <-done:
Expand Down Expand Up @@ -69,7 +74,7 @@ func waitForServerState(state, power, serverID string, client *govultr.Client, t
return
}

time.Sleep(3 * time.Second)
time.Sleep(sleepDurationSeconds * time.Second)

// Verify we shouldn't exit
select {
Expand Down Expand Up @@ -111,7 +116,7 @@ func waitForSnapshotState(state, snapshotID string, client *govultr.Client, time
return
}

time.Sleep(3 * time.Second)
time.Sleep(sleepDurationSeconds * time.Second)

// Verify we shouldn't exit
select {
Expand Down
Loading

0 comments on commit 78beabe

Please sign in to comment.