Skip to content

Commit 46a2b12

Browse files
authored
Enable lint (#1646)
* Enable Lint * Enable Lint * Enable Lint * FIx Installation steps * FIx Installation steps * FIx Installation steps * FIx Installation steps * FIx Installation steps * FIx Installation steps * FIx Installation steps * Install lint using go get * Install lint using go get * Install lint using go get * Install lint using go get * Install lint using go get * Install lint using go get * Install lint using curl * Removing unused code * Removing unused code * Removing unused code * Removing unused code * Removing unused code * Removing unused code * Removing unused code * Removing unused code * Updated dependencies * Unused code. * Adding vet * Go vet * Go vet
1 parent 75d60ac commit 46a2b12

16 files changed

+379
-208
lines changed

azure-pipelines.yml

+19
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ pr:
1111
- main
1212

1313
jobs:
14+
1415
- job: Build
1516
timeoutInMinutes: 360
1617
strategy:
@@ -25,8 +26,26 @@ jobs:
2526
vmImage: $(imageName)
2627
steps:
2728
- task: GoTool@0
29+
env:
30+
GO111MODULE: 'on'
2831
inputs:
2932
version: '1.16'
33+
34+
- script: |
35+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.43.0
36+
echo 'Installation complete'
37+
./bin/golangci-lint --version
38+
./bin/golangci-lint run e2etest
39+
displayName: 'Golang Lint Check - Linux'
40+
workingDirectory: $(System.DefaultWorkingDirectory)
41+
condition: eq(variables.type, 'linux')
42+
43+
- script: |
44+
echo 'Running GO Vet'
45+
go vet
46+
displayName: 'Golang Vet - Linux'
47+
workingDirectory: $(System.DefaultWorkingDirectory)
48+
3049
- script: |
3150
GOARCH=amd64 GOOS=linux go build -o "$(Build.ArtifactStagingDirectory)/azcopy_linux_amd64"
3251
GOARCH=amd64 GOOS=linux go build -tags "se_integration" -o "$(Build.ArtifactStagingDirectory)/azcopy_linux_se_amd64"

e2etest/declarativeHelpers.go

+1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ func equals() comparison {
5151
return comparison{true}
5252
}
5353

54+
//nolint
5455
func notEquals() comparison {
5556
return comparison{false}
5657
}

e2etest/declarativeResourceManagers.go

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ type downloadContentOptions struct {
4444
downloadFileContentOptions
4545
}
4646

47+
//nolint
4748
type downloadBlobContentOptions struct {
4849
containerURL azblob.ContainerURL
4950
cpkInfo common.CpkInfo

e2etest/declarativeRunner.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import (
3535

3636
// RunScenarios is the key entry point for declarative testing.
3737
// It constructs and executes scenarios (subtest in Go-speak), according to its parameters, and checks their results
38-
func RunScenarios(
38+
func RunScenarios(
3939
t *testing.T,
4040
operations Operation,
4141
testFromTo TestFromTo,

e2etest/declarativeScenario.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ func (s *scenario) validateProperties() {
351351
// TODO: JohnR: need to remove the strip top dir prefix from the map (and normalize the delimiters)
352352
// since currently uploads fail here
353353
var rawPaths []string
354-
for rawPath, _ := range destProps {
354+
for rawPath := range destProps {
355355
rawPaths = append(rawPaths, rawPath)
356356
}
357357
s.a.Error(fmt.Sprintf("could not find expected file %s in keys %v", destName, rawPaths))
@@ -538,6 +538,7 @@ func (s *scenario) validateLastWriteTime(expected, actual *time.Time) {
538538
expected, actual))
539539
}
540540

541+
//nolint
541542
func (s *scenario) validateSMBAttrs(expected, actual *uint32) {
542543
if expected == nil {
543544
// These properties were not explicitly stated for verification

e2etest/declarativeTestFiles.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ func (op objectProperties) DeepCopy() objectProperties {
123123
ret.isFolder = op.isFolder
124124

125125
if op.size != nil {
126-
val := *&op.size
126+
val := op.size
127127
ret.size = val
128128
}
129129

e2etest/declarativeWithPropertyProviders.go

+2
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,12 @@ func (w with) createObjectProperties() *objectProperties {
173173
// use createOnly if you want to define properties that should be used when creating an object, but not
174174
// used when verifying the state of the transferred object. Generally you'll have no use for this.
175175
// Just use "with", and the test framework will do the right thing.
176+
//nolint
176177
type createOnly struct {
177178
with
178179
}
179180

181+
//nolint
180182
func (createOnly) appliesToVerification() bool {
181183
return false
182184
}

e2etest/factory.go

+2
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ func getTestName(t *testing.T) (pseudoSuite, test string) {
241241
return pseudoSuite, removeUnderscores(testName)
242242
}
243243

244+
//nolint
244245
// This function generates an entity name by concatenating the passed prefix,
245246
// the name of the test requesting the entity name, and the minute, second, and nanoseconds of the call.
246247
// This should make it easy to associate the entities with their test, uniquely identify
@@ -271,6 +272,7 @@ func (TestResourceNameGenerator) GenerateContainerName(c asserter) string {
271272
return uuid.New().String()
272273
}
273274

275+
//nolint
274276
func (TestResourceNameGenerator) generateBlobName(c asserter) string {
275277
return generateName(c, blobPrefix, 0)
276278
}

0 commit comments

Comments
 (0)