Switch from golint to revive (#8010)
This commit is contained in:
parent
236ce54269
commit
2e5fedff54
|
@ -7,7 +7,7 @@ linters:
|
|||
- errcheck
|
||||
- goconst
|
||||
- gofmt
|
||||
- golint
|
||||
- revive
|
||||
- gosec
|
||||
- govet
|
||||
- ineffassign
|
||||
|
|
|
@ -349,6 +349,7 @@ func (g *generator) genObjectConsExpression(
|
|||
// first lower all inner expressions and emit temps
|
||||
for i, item := range expr.Items {
|
||||
// don't treat keys as inputs
|
||||
//nolint: revive
|
||||
k, kTemps := g.lowerExpression(item.Key, item.Key.Type())
|
||||
temps = append(temps, kTemps...)
|
||||
item.Key = k
|
||||
|
|
|
@ -101,6 +101,7 @@ type langConfig struct {
|
|||
//
|
||||
// The PCL file is the only piece that must be manually authored. Once the schema has been written, the expected outputs
|
||||
// can be generated by running `PULUMI_ACCEPT=true go test ./..." from the `pkg/codegen` directory.
|
||||
//nolint: revive
|
||||
func TestProgramCodegen(
|
||||
t *testing.T,
|
||||
language string,
|
||||
|
|
|
@ -137,6 +137,7 @@ type checkPackageSignature = func(t *testing.T, pwd string)
|
|||
//
|
||||
// The schema is the only piece that must be manually authored. Once the schema has been written, the expected outputs
|
||||
// can be generated by running `PULUMI_ACCEPT=true go test ./..." from the `pkg/codegen` directory.
|
||||
//nolint: revive
|
||||
func TestSDKCodegen(t *testing.T, language string, genPackage GenPkgSignature, checkPackage checkPackageSignature) {
|
||||
testDir := filepath.Join("..", "internal", "test", "testdata")
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ type NewTypeNameGeneratorFunc func(pkg *schema.Package) TypeNameGeneratorFunc
|
|||
|
||||
type TypeNameGeneratorFunc func(t schema.Type) string
|
||||
|
||||
func TestTypeNameCodegen(t *testing.T, language string, newTypeNameGenerator NewTypeNameGeneratorFunc) {
|
||||
func TestTypeNameCodegen(t *testing.T, language string, newTypeNameGenerator NewTypeNameGeneratorFunc) { //nolint:revive
|
||||
// Read in, decode, and import the schema.
|
||||
schemaBytes, err := os.ReadFile(filepath.FromSlash("../internal/test/testdata/types.json"))
|
||||
require.NoError(t, err)
|
||||
|
|
|
@ -928,10 +928,7 @@ func (mod *modContext) genTypes(dir string, fs fs) error {
|
|||
if err := genTypes("_inputs.py", true); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := genTypes("outputs.py", false); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
return genTypes("outputs.py", false)
|
||||
}
|
||||
|
||||
func awaitableTypeNames(tok string) (baseName, awaitableName string) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2016-2020, Pulumi Corporation.
|
||||
// Copyright 2016-2021, Pulumi Corporation.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -16,7 +16,7 @@ package schema
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
_ "embed" //nolint: golint
|
||||
_ "embed"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2016-2018, Pulumi Corporation.
|
||||
// Copyright 2016-2021, Pulumi Corporation.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -16,7 +16,6 @@ package engine
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/opentracing/opentracing-go"
|
||||
|
@ -177,9 +176,9 @@ func newDeployment(ctx *Context, info *deploymentContext, opts deploymentOptions
|
|||
imp := &opts.imports[i]
|
||||
_, err := tokens.ParseTypeToken(imp.Type.String())
|
||||
if err != nil {
|
||||
return nil, errors.New(fmt.Sprintf("import type %q is not a valid resource type token. "+
|
||||
return nil, errors.Errorf("import type %q is not a valid resource type token. "+
|
||||
"Type tokens must be of the format <package>:<module>:<type> - "+
|
||||
"refer to the import section of the provider resource documentation.", imp.Type.String()))
|
||||
"refer to the import section of the provider resource documentation.", imp.Type.String())
|
||||
}
|
||||
if imp.Provider == "" && imp.Version == nil {
|
||||
imp.Version = defaultProviderVersions[imp.Type.Package()]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//nolint:golint
|
||||
//nolint:revive
|
||||
package lifecycletest
|
||||
|
||||
import (
|
||||
|
|
|
@ -1995,7 +1995,7 @@ func (pt *ProgramTester) prepareDotNetProject(projinfo *engine.Projinfo) error {
|
|||
return errors.Wrap(err, "failed to find a local Pulumi NuGet package")
|
||||
}
|
||||
if len(matches) != 1 {
|
||||
return errors.New(fmt.Sprintf("attempting to find a local Pulumi NuGet package yielded %v results", matches))
|
||||
return errors.Errorf("attempting to find a local Pulumi NuGet package yielded %v results", matches)
|
||||
}
|
||||
file := filepath.Base(matches[0])
|
||||
r := strings.NewReplacer(dep+".", "", ".nupkg", "")
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2016-2020, Pulumi Corporation.
|
||||
// Copyright 2016-2021, Pulumi Corporation.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -518,10 +518,10 @@ func validatePulumiVersion(minVersion semver.Version, currentVersion semver.Vers
|
|||
return nil
|
||||
}
|
||||
if minVersion.Major < currentVersion.Major {
|
||||
return errors.New(fmt.Sprintf("Major version mismatch. You are using Pulumi CLI version %s with Automation SDK v%v. Please update the SDK.", currentVersion, minVersion.Major))
|
||||
return errors.Errorf("Major version mismatch. You are using Pulumi CLI version %s with Automation SDK v%v. Please update the SDK.", currentVersion, minVersion.Major)
|
||||
}
|
||||
if minVersion.GT(currentVersion) {
|
||||
return errors.New(fmt.Sprintf("Minimum version requirement failed. The minimum CLI version requirement is %s, your current CLI version is %s. Please update the Pulumi CLI.", minimumVersion, currentVersion))
|
||||
return errors.Errorf("Minimum version requirement failed. The minimum CLI version requirement is %s, your current CLI version is %s. Please update the Pulumi CLI.", minimumVersion, currentVersion)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ type Secret struct {
|
|||
// - The ID may be unknown (in which case it will be the unknown property value)
|
||||
// - Otherwise, the ID must be a string.
|
||||
//
|
||||
//nolint: golint
|
||||
//nolint: revive
|
||||
type ResourceReference struct {
|
||||
URN URN
|
||||
ID PropertyValue
|
||||
|
|
|
@ -25,25 +25,25 @@ import (
|
|||
|
||||
// projectSingleton is a singleton instance of projectLoader, which controls a global map of instances of Project
|
||||
// configs (one per path).
|
||||
var projectSingleton *projectLoader = &projectLoader{
|
||||
var projectSingleton = &projectLoader{
|
||||
internal: map[string]*Project{},
|
||||
}
|
||||
|
||||
// projectStackSingleton is a singleton instance of projectStackLoader, which controls a global map of instances of
|
||||
// ProjectStack configs (one per path).
|
||||
var projectStackSingleton *projectStackLoader = &projectStackLoader{
|
||||
var projectStackSingleton = &projectStackLoader{
|
||||
internal: map[string]*ProjectStack{},
|
||||
}
|
||||
|
||||
// pluginProjectSingleton is a singleton instance of pluginProjectLoader, which controls a global map of instances of
|
||||
// PluginProject configs (one per path).
|
||||
var pluginProjectSingleton *pluginProjectLoader = &pluginProjectLoader{
|
||||
var pluginProjectSingleton = &pluginProjectLoader{
|
||||
internal: map[string]*PluginProject{},
|
||||
}
|
||||
|
||||
// policyPackProjectSingleton is a singleton instance of policyPackProjectLoader, which controls a global map of
|
||||
// instances of PolicyPackProject configs (one per path).
|
||||
var policyPackProjectSingleton *policyPackProjectLoader = &policyPackProjectLoader{
|
||||
var policyPackProjectSingleton = &policyPackProjectLoader{
|
||||
internal: map[string]*PolicyPackProject{},
|
||||
}
|
||||
|
||||
|
|
|
@ -305,7 +305,6 @@ func save(path string, value interface{}, mkDirAll bool) error {
|
|||
}
|
||||
}
|
||||
|
||||
// Changing the permissions on these file is ~ a breaking change, so disable golint.
|
||||
//nolint: gosec
|
||||
return ioutil.WriteFile(path, b, 0644)
|
||||
}
|
||||
|
|
|
@ -497,7 +497,7 @@ func Transformations(o []ResourceTransformation) ResourceOption {
|
|||
}
|
||||
|
||||
// URN_ is an optional URN of a previously-registered resource of this type to read from the engine.
|
||||
//nolint: golint
|
||||
//nolint: revive
|
||||
func URN_(o string) ResourceOption {
|
||||
return resourceOption(func(ro *resourceOptions) {
|
||||
ro.URN = o
|
||||
|
|
|
@ -25,7 +25,7 @@ import (
|
|||
func TestWorkGroupActsAsWaitGroup(t *testing.T) {
|
||||
check := func(j int) func(*testing.T) {
|
||||
return func(*testing.T) {
|
||||
var n int32 = 0
|
||||
var n int32
|
||||
wg := &workGroup{}
|
||||
wg.Add(j)
|
||||
|
||||
|
|
|
@ -573,7 +573,7 @@ func TestConfigPaths(t *testing.T) {
|
|||
e.RunCommand("pulumi", "stack", "rm", "--yes")
|
||||
}
|
||||
|
||||
//nolint:golint,deadcode
|
||||
//nolint:deadcode
|
||||
func pathEnv(t *testing.T, path ...string) string {
|
||||
pathEnv := []string{os.Getenv("PATH")}
|
||||
for _, p := range path {
|
||||
|
@ -591,12 +591,12 @@ func pathEnv(t *testing.T, path ...string) string {
|
|||
return "PATH=" + strings.Join(pathEnv, pathSeparator)
|
||||
}
|
||||
|
||||
//nolint:golint,deadcode
|
||||
//nolint:deadcode
|
||||
func testComponentSlowPathEnv(t *testing.T) string {
|
||||
return pathEnv(t, filepath.Join("construct_component_slow", "testcomponent"))
|
||||
}
|
||||
|
||||
//nolint:golint,deadcode
|
||||
//nolint:deadcode
|
||||
func testComponentPlainPathEnv(t *testing.T) string {
|
||||
return pathEnv(t, filepath.Join("construct_component_plain", "testcomponent"))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue