Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version-file: 'go.mod'
go-version-file: ./.go-version
- name: Determine Go version
id: get-go-version
# looking for just the number, eg. 1.18.3
Expand Down Expand Up @@ -59,7 +59,7 @@ jobs:
version: ${{ needs.get-product-version.outputs.product-version }}
product: ${{ env.PKG_NAME }}
repositoryOwner: "hashicorp"
- uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: metadata.json
path: ${{ steps.generate-metadata-file.outputs.filepath }}
Expand Down Expand Up @@ -104,7 +104,7 @@ jobs:
go build -o dist/ -ldflags "-s -w -X $(go list -m)/version.GitCommit=$(git rev-parse --short HEAD)" .
zip -r -j out/${{ env.PKG_NAME }}_${{ needs.get-product-version.outputs.product-version }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip dist/

- uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: ${{ env.PKG_NAME }}_${{ needs.get-product-version.outputs.product-version }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip
path: out/${{ env.PKG_NAME }}_${{ needs.get-product-version.outputs.product-version }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip
Expand Down Expand Up @@ -147,7 +147,7 @@ jobs:
go build -o dist/ -ldflags "-s -w -X $(go list -m)/version.GitCommit=$(git rev-parse --short HEAD)" .
zip -r -j out/${{ env.PKG_NAME }}_${{ needs.get-product-version.outputs.product-version }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip dist/

- uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: ${{ env.PKG_NAME }}_${{ needs.get-product-version.outputs.product-version }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip
path: out/${{ env.PKG_NAME }}_${{ needs.get-product-version.outputs.product-version }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip
Expand Down Expand Up @@ -182,13 +182,13 @@ jobs:
echo "RPM_PACKAGE=$(basename out/*.rpm)" >> $GITHUB_ENV
echo "DEB_PACKAGE=$(basename out/*.deb)" >> $GITHUB_ENV

- uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
if: ${{ matrix.goos == 'linux' }}
with:
name: ${{ env.RPM_PACKAGE }}
path: out/${{ env.RPM_PACKAGE }}

- uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
if: ${{ matrix.goos == 'linux' }}
with:
name: ${{ env.DEB_PACKAGE }}
Expand All @@ -210,7 +210,7 @@ jobs:
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Docker Build (Action)
uses: hashicorp/actions-docker-build@v2
uses: hashicorp/actions-docker-build@200254326a30d7b747745592f8f4d226bbe4abe4 # v2.2.0
with:
# Add smoke test here. Below is a sample smoke test that runs the built image
# and validates the version.
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ jobs:
- name: Set up Go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version-file: 'go.mod'
go-version-file: ./.go-version

- name: Run linters
uses: golangci/golangci-lint-action@a4f60bb28d35aeee14e6880718e0c85ff1882e64 # v6.0.1
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0
with:
version: v1.62.0
version: v2.1
1 change: 1 addition & 0 deletions .go-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.24.3
165 changes: 80 additions & 85 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,94 +1,89 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

version: "2"
run:
concurrency: 4
linters:
disable-all: true
default: none
enable:
- gofmt
- depguard
- forbidigo
- gomodguard
- govet
- unconvert
- staticcheck
- ineffassign
- staticcheck
- unconvert
- unparam
- forbidigo
- gomodguard
- gosimple
- depguard

issues:
# Disable the default exclude list so that all excludes are explicitly
# defined in this file.
exclude-use-default: false
exclude-rules:
- text: 'shadow: declaration of "(err|ctx)" shadows declaration at'
linters: [ govet ]
exclude-dirs-use-default: false

linters-settings:
govet:
enable-all: true
disable:
- fieldalignment
- nilness
- unusedwrite
forbidigo:
# Forbid the following identifiers (list of regexp).
forbid:
- '\bioutil\b(# Use io and os packages instead of ioutil)?'
- '\brequire\.New\b(# Use package-level functions with explicit TestingT)?'
- '\bassert\.New\b(# Use package-level functions with explicit TestingT)?'
# Exclude godoc examples from forbidigo checks.
# Default: true
exclude_godoc_examples: false
gofmt:
simplify: true
gomodguard:
blocked:
# List of blocked modules.
modules:
# Blocked module.
- github.com/hashicorp/go-msgpack:
recommendations:
- github.com/hashicorp/consul-net-rpc/go-msgpack
- github.com/golang/protobuf:
recommendations:
- google.golang.org/protobuf
depguard:
settings:
depguard:
rules:
main:
files:
- $all
allow:
- $gostd
- github.com/BurntSushi/toml
- golang.org/x/sys/unix
- golang.org/x/exp/maps
- golang.org/x/text/cases
- golang.org/x/text/language
- gopkg.in/yaml.v2
- github.com/Masterminds/sprig/v3
- github.com/davecgh/go-spew/spew
- github.com/hashicorp/consul-template
- github.com/hashicorp/consul/api
- github.com/hashicorp/consul/sdk/testutil
- github.com/hashicorp/go-gatedio
- github.com/hashicorp/go-hclog
- github.com/hashicorp/go-multierror
- github.com/hashicorp/go-rootcerts
- github.com/hashicorp/go-sockaddr/template
- github.com/hashicorp/go-syslog
- github.com/hashicorp/hcl
- github.com/hashicorp/logutils
- github.com/hashicorp/nomad/api
- github.com/hashicorp/vault/api
- dario.cat/mergo
- github.com/mitchellh/go-homedir
- github.com/mitchellh/hashstructure
- github.com/mitchellh/mapstructure
- github.com/pkg/errors
- github.com/ryanuber/go-glob
- github.com/stretchr/testify/assert
- github.com/stretchr/testify/require
- github.com/coreos/go-systemd
forbidigo:
forbid:
- pattern: \bioutil\b(# Use io and os packages instead of ioutil)?
- pattern: \brequire\.New\b(# Use package-level functions with explicit TestingT)?
- pattern: \bassert\.New\b(# Use package-level functions with explicit TestingT)?
gomodguard:
blocked:
modules:
- github.com/hashicorp/go-msgpack:
recommendations:
- github.com/hashicorp/consul-net-rpc/go-msgpack
- github.com/golang/protobuf:
recommendations:
- google.golang.org/protobuf
govet:
disable:
- fieldalignment
- nilness
- unusedwrite
enable-all: true
exclusions:
generated: lax
rules:
main:
# List of file globs that will match this list of settings to compare against.
# Default: $all
files:
- $all
# List of allowed packages.
allow:
- $gostd
- github.com/BurntSushi/toml
- github.com/Masterminds/sprig/v3
- github.com/davecgh/go-spew/spew
- github.com/hashicorp/consul-template
- github.com/hashicorp/consul/api
- github.com/hashicorp/consul/sdk/testutil
- github.com/hashicorp/go-gatedio
- github.com/hashicorp/go-hclog
- github.com/hashicorp/go-multierror
- github.com/hashicorp/go-rootcerts
- github.com/hashicorp/go-sockaddr/template
- github.com/hashicorp/go-syslog
- github.com/hashicorp/hcl
- github.com/hashicorp/logutils
- github.com/hashicorp/nomad/api
- github.com/hashicorp/vault/api
- dario.cat/mergo
- github.com/mitchellh/go-homedir
- github.com/mitchellh/hashstructure
- github.com/mitchellh/mapstructure
- github.com/ryanuber/go-glob
- github.com/pkg/errors
- github.com/stretchr/testify/assert
- github.com/stretchr/testify/require
- github.com/coreos/go-systemd

run:
timeout: 10m
concurrency: 4
- linters:
- govet
text: 'shadow: declaration of "(err|ctx)" shadows declaration at'
formatters:
enable:
- gofmt
settings:
gofmt:
simplify: true
exclusions:
generated: lax
2 changes: 1 addition & 1 deletion child/child_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ func TestSetsid(t *testing.T) {
}
defer c.Stop()

var sid int = -1
var sid = -1

os := runtime.GOOS

Expand Down
2 changes: 1 addition & 1 deletion config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2058,7 +2058,7 @@ func TestFinalize(t *testing.T) {
}
default:
if eq, err := tc.isEqual(tc.test, tc.expt); !eq {
t.Error(err.Error())
t.Errorf("%s", err.Error())
}
}
})
Expand Down
4 changes: 2 additions & 2 deletions dependency/vault_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ func shimKvV2ListPath(rawPath, mountPath string) string {
return rawPath
}

switch {
case rawPath == mountPath:
switch rawPath {
case mountPath:
return path.Join(mountPath, "metadata")
default:
rawPath = strings.TrimPrefix(rawPath, mountPath)
Expand Down
4 changes: 2 additions & 2 deletions dependency/vault_read_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -531,8 +531,8 @@ func TestVaultReadQuery_Fetch_PKI_Anonymous(t *testing.T) {
_, err = anonClient.vault.client.Auth().Token().LookupSelf()
// 'missing client token' vault <1.9.7, 'permission denied' vault >1.10.0
if err == nil ||
!(strings.Contains(err.Error(), "missing client token") ||
strings.Contains(err.Error(), "permission denied")) {
(!strings.Contains(err.Error(), "missing client token") &&
!strings.Contains(err.Error(), "permission denied")) {
// check environment for VAULT_TOKEN
t.Fatalf("expected a 'missing client token' (vault < 1.10) or 'permission denied' error but found: %v", err)
}
Expand Down
16 changes: 7 additions & 9 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
module github.com/hashicorp/consul-template

go 1.22

toolchain go1.22.4
go 1.24

require (
github.com/BurntSushi/toml v1.3.2
Expand All @@ -25,17 +23,17 @@ require (
github.com/mitchellh/mapstructure v1.5.0
github.com/pkg/errors v0.9.1
github.com/stretchr/testify v1.8.4
golang.org/x/crypto v0.32.0 // indirect
golang.org/x/sys v0.29.0
golang.org/x/crypto v0.38.0 // indirect
golang.org/x/sys v0.33.0
gopkg.in/yaml.v2 v2.4.0
)

require (
dario.cat/mergo v1.0.0
github.com/Masterminds/sprig/v3 v3.2.3
github.com/hashicorp/vault/api/auth/kubernetes v0.5.0
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842
golang.org/x/text v0.21.0
golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6
golang.org/x/text v0.25.0
)

require (
Expand Down Expand Up @@ -69,7 +67,7 @@ require (
github.com/ryanuber/go-glob v1.0.0 // indirect
github.com/shopspring/decimal v1.3.1 // indirect
github.com/spf13/cast v1.5.0 // indirect
golang.org/x/net v0.34.0
golang.org/x/time v0.3.0 // indirect
golang.org/x/net v0.40.0 // indirect
golang.org/x/time v0.11.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading
Loading