Skip to content

Commit a7c7fbc

Browse files
Merge pull request #151 from hashicorp/linting
2 parents ec1a6b6 + 16ca2c0 commit a7c7fbc

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

.github/workflows/go-tests.yml

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
run: go mod download
3131

3232
- name: Cache / restore go modules
33-
uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 # v3.2.6
33+
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
3434
with:
3535
path: |
3636
~/go/pkg/mod
@@ -48,6 +48,9 @@ jobs:
4848
echo "$files"
4949
exit 1
5050
fi
51+
52+
- name: Run golangci-lint
53+
uses: golangci/golangci-lint-action@08e2f20817b15149a52b5b3ebe7de50aff2ba8c5
5154

5255
# Install gotestsum with go get for 1.15.3; otherwise default to go install
5356
- name: Install gotestsum
@@ -64,11 +67,20 @@ jobs:
6467
- name: Run go tests
6568
run: |
6669
PACKAGE_NAMES=$(go list ./...)
67-
gotestsum --format=short-verbose --junitfile $TEST_RESULTS/gotestsum-report.xml -- $PACKAGE_NAMES
70+
gotestsum --format=short-verbose --junitfile $TEST_RESULTS/gotestsum-report.xml -- -p 2 -cover -coverprofile=coverage.out $PACKAGE_NAMES
6871
6972
# Save coverage report parts
7073
- name: Upload and save artifacts
71-
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
74+
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808
75+
with:
76+
name: Test Results-${{matrix.go-version}}
77+
path: ${{ env.TEST_RESULTS }}
78+
79+
- name: Upload coverage report
80+
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808
7281
with:
73-
name: Test Results
74-
path: ${{ env.TEST_RESULTS }}
82+
path: coverage.out
83+
name: Coverage-report-${{matrix.go-version}}
84+
85+
- name: Display coverage report
86+
run: go tool cover -func=coverage.out

version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ func (v *Version) String() string {
389389
str := strconv.FormatInt(s, 10)
390390
fmtParts[i] = str
391391
}
392-
fmt.Fprintf(&buf, strings.Join(fmtParts, "."))
392+
fmt.Fprintf(&buf, "%s", strings.Join(fmtParts, "."))
393393
if v.pre != "" {
394394
fmt.Fprintf(&buf, "-%s", v.pre)
395395
}

0 commit comments

Comments
 (0)