Skip to content

Cannot build project with golang 1.18 #150

@amorenoz

Description

@amorenoz

There are many linting errors that stop the project from being built/used.

make build
cmd/confgenerator/main.go:27:2: "github.com/json-iterator/go" imported but not used as jsoniter (typecheck)
        jsoniter "github.com/json-iterator/go"
        ^
cmd/flowlogs-pipeline/main.go:28:2: "github.com/json-iterator/go" imported but not used as jsoniter (typecheck)
        jsoniter "github.com/json-iterator/go"
        ^
pkg/confgen/confgen.go:150:8: undeclared name: `yaml` (typecheck)
        err = yaml.Unmarshal(yamlFile, &defFile)
              ^
pkg/confgen/config.go:78:8: undeclared name: `yaml` (typecheck)
        err = yaml.Unmarshal(yamlFile, &config)
              ^
pkg/confgen/flowlogs2metrics_config.go:115:21: undeclared name: `yaml` (typecheck)
        configData, err := yaml.Marshal(&config)
                           ^
pkg/confgen/confgen.go:29:2: "gopkg.in/yaml.v2" imported but not used (typecheck)
        "gopkg.in/yaml.v2"
        ^
pkg/confgen/config.go:25:2: "gopkg.in/yaml.v2" imported but not used (typecheck)
        "gopkg.in/yaml.v2"
        ^
pkg/confgen/flowlogs2metrics_config.go:24:2: "gopkg.in/yaml.v2" imported but not used (typecheck)
        "gopkg.in/yaml.v2"
        ^
pkg/pipeline/pipeline_test.go:25:2: "github.com/netobserv/flowlogs-pipeline/pkg/pipeline/decode" imported but not used (typecheck)
        "github.com/netobserv/flowlogs-pipeline/pkg/pipeline/decode"
        ^
pkg/pipeline/pipeline_test.go:26:2: "github.com/netobserv/flowlogs-pipeline/pkg/pipeline/ingest" imported but not used (typecheck)
        "github.com/netobserv/flowlogs-pipeline/pkg/pipeline/ingest"
        ^
pkg/pipeline/encode/encode_prom.go:21:2: could not import container/list (-: could not load export data: cannot import "container/list" (unstable iexport format version 2, just rebuild compiler and std library), export data is newer version - update tool) (typecheck)
        "container/list"
        ^
pkg/pipeline/transform/transform_network.go:54:25: n.Rules undefined (type *Network has no field or method Rules) (typecheck)
        for _, rule := range n.Rules {
                               ^
pkg/pipeline/transform/connection_tracking/connection_tracking.go:21:2: could not import container/list (-: could not load export data: cannot import "container/list" (unstable iexport format version 2, just rebuild compiler and std library), export data is newer version - update tool) (typecheck)
        "container/list"
        ^
pkg/pipeline/transform/kubernetes/kubernetes_test.go:86:15: informerMock.On undefined (type *InformerMock has no field or method On) (typecheck)
        informerMock.On("GetIndexer", mock.Anything, mock.Anything, mock.Anything).Return(nil)
                     ^
pkg/pipeline/transform/kubernetes/kubernetes.go:28:2: "k8s.io/api/apps/v1" imported but not used as appsv1 (typecheck)
        appsv1 "k8s.io/api/apps/v1"
        ^
pkg/pipeline/transform/location/location.go:54:17: undeclared name: `ip2location` (typecheck)
var locationDB *ip2location.DB
                ^
pkg/pipeline/transform/location/location.go:146:19: undeclared name: `ip2location` (typecheck)
        db, openDBErr := ip2location.OpenDB(DBFileLocation + "/" + DBFilename)
                         ^
pkg/pipeline/transform/location/location_test.go:125:16: undeclared name: `ip2location` (typecheck)
        locationDB = &ip2location.DB{}
                      ^
pkg/pipeline/transform/location/location.go:33:2: "github.com/ip2location/ip2location-go/v9" imported but not used (typecheck)
        "github.com/ip2location/ip2location-go/v9"
        ^
pkg/pipeline/transform/location/location_test.go:31:2: "github.com/ip2location/ip2location-go/v9" imported but not used (typecheck)
        "github.com/ip2location/ip2location-go/v9"
        ^
pkg/pipeline/write/write_loki_test.go:108:5: fe.On undefined (type fakeEmitter has no field or method On) (typecheck)
        fe.On("Handle", mock.Anything, mock.Anything, mock.Anything).Return(nil)
           ^
pkg/pipeline/write/write_loki_test.go:118:5: fe.AssertCalled undefined (type fakeEmitter has no field or method AssertCalled) (typecheck)
        fe.AssertCalled(t, "Handle", model.LabelSet{
           ^
pkg/pipeline/write/write_loki_test.go:124:5: fe.AssertCalled undefined (type fakeEmitter has no field or method AssertCalled) (typecheck)
        fe.AssertCalled(t, "Handle", model.LabelSet{
           ^
pkg/pipeline/write/write_loki_test.go:161:7: fe.On undefined (type fakeEmitter has no field or method On) (typecheck)
                        fe.On("Handle", mock.Anything, mock.Anything, mock.Anything).Return(nil)
                           ^
pkg/pipeline/write/write_loki_test.go:165:7: fe.AssertCalled undefined (type fakeEmitter has no field or method AssertCalled) (typecheck)
                        fe.AssertCalled(t, "Handle", model.LabelSet{},
                           ^
pkg/pipeline/write/write_loki_test.go:204:7: fe.On undefined (type fakeEmitter has no field or method On) (typecheck)
                        fe.On("Handle", mock.Anything, mock.Anything, mock.Anything).Return(nil)
                           ^
make: *** [Makefile:69: lint] Error 1
golangci-lint version
golangci-lint has version 1.39.0 built from 9aea4aee on 2021-03-26T08:02:53Z

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions