Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump pkg and test submodule and github CI go version to 1.18 #375

Merged
merged 3 commits into from
Sep 8, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/e2e-core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
timeout-minutes: 30
strategy:
matrix:
go-version: [ 1.16 ]
go-version: [ 1.18 ]
runner: [ ubuntu ]
fail-fast: true
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
timeout-minutes: 30
strategy:
matrix:
go-version: [ 1.16 ]
go-version: [ 1.18 ]
runner: [ ubuntu ]
fail-fast: true
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/static-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
timeout-minutes: 30
strategy:
matrix:
go-version: [ 1.16 ]
go-version: [ 1.18 ]
runner: [ ubuntu, macos ]
fail-fast: true
steps:
Expand Down
6 changes: 3 additions & 3 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ linters-settings:
gosec:
# To select a subset of rules to run.
# Available rules: https://github.com/securego/gosec#available-rules
includes:
excludes:
- G204
govet:
Expand Down Expand Up @@ -104,7 +103,6 @@ linters-settings:

misspell:
locale: US
ignore-words:

linters:
disable:
Expand All @@ -129,7 +127,6 @@ issues:
# But independently from this option we use default exclude patterns,
# it can be disabled by `exclude-use-default: false`. To list all
# excluded by default patterns execute `golangci-lint run --help`
exclude:

# Excluding configuration per-path, per-linter, per-text and per-source
exclude-rules:
Expand All @@ -143,6 +140,9 @@ issues:
- path: plugins/test
linters:
- revive
- linters:
- staticcheck
text: "SA1019:"
# The list of ids of default excludes to include or disable. By default it's empty.
# See the list of default excludes here https://golangci-lint.run/usage/configuration.
include:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ DIST_DIR = ilogtail-$(VERSION)

.PHONY: tools
tools:
$(GO_LINT) version || curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GO_PATH)/bin v1.39.0
$(GO_LINT) version || curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GO_PATH)/bin v1.49.0
$(GO_ADDLICENSE) version || go install github.com/google/addlicense@latest

.PHONY: clean
Expand Down
2 changes: 1 addition & 1 deletion helper/container_discover_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
var FetchAllInterval = time.Second * time.Duration(300)

// fetchAllSuccessTimeout controls when to force timeout containers if fetchAll
// failed continuously. By default, 20 times of FetchAllInterval.
// failed continuously. By default, 20 times of FetchAllInterval.
var fetchAllSuccessTimeout = FetchAllInterval * 20
var DockerCenterTimeout = time.Second * time.Duration(30)
var MaxFetchOneTriggerPerSecond int32 = 200
Expand Down
13 changes: 7 additions & 6 deletions helper/container_export.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,18 +122,19 @@ func GetContainerByAcceptedInfo(

// GetContainerByAcceptedInfoV2 works like GetContainerByAcceptedInfo, but uses less CPU.
// It reduces CPU cost by using full list and match list to find containers that
// need to be check.
// need to be check.
//
yyuuttaaoo marked this conversation as resolved.
Show resolved Hide resolved
// deleted = fullList - containerMap
// newList = containerMap - fullList
// matchList -= deleted + filter(newList)
// return len(deleted), len(filter(newList))
// deleted = fullList - containerMap
// newList = containerMap - fullList
// matchList -= deleted + filter(newList)
// return len(deleted), len(filter(newList))
//
// @param fullList [in,out]: all containers.
// @param matchList [in,out]: all matched containers.
//
// It returns two integers: the number of new matched containers
// and deleted containers.
//
// and deleted containers.
func GetContainerByAcceptedInfoV2(
fullList map[string]bool,
matchList map[string]*DockerInfoDetail,
Expand Down
2 changes: 1 addition & 1 deletion helper/docker_center.go
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ func (dc *DockerCenter) getIPAddress(info *docker.Container) string {

// CreateInfoDetail create DockerInfoDetail with docker.Container
// Container property used in this function : HostsPath, Config.Hostname, Name, Config.Image, Config.Env, Mounts
// ContainerInfo.GraphDriver.Data["UpperDir"] Config.Labels
// ContainerInfo.GraphDriver.Data["UpperDir"] Config.Labels
func (dc *DockerCenter) CreateInfoDetail(info *docker.Container, envConfigPrefix string, selfConfigFlag bool) *DockerInfoDetail {
containerNameTag := make(map[string]string)
k8sInfo := K8SInfo{}
Expand Down
4 changes: 2 additions & 2 deletions helper/docker_cri_adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func IsCRIStatusValid(criRuntimeEndpoint string) bool {
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
defer cancel()

conn, err := grpc.DialContext(ctx, addr, grpc.WithInsecure(), grpc.WithDialer(dailer), grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(1024*1024*16))) //nolint:staticcheck
conn, err := grpc.DialContext(ctx, addr, grpc.WithInsecure(), grpc.WithDialer(dailer), grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(1024*1024*16)))
if err != nil {
return false
}
Expand Down Expand Up @@ -188,7 +188,7 @@ func newRuntimeServiceClient() (cri.RuntimeServiceClient, error) {
ctx, cancel := context.WithTimeout(context.Background(), time.Second*10)
defer cancel()

conn, err := grpc.DialContext(ctx, addr, grpc.WithInsecure(), grpc.WithDialer(dailer), grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(maxMsgSize))) //nolint:staticcheck
conn, err := grpc.DialContext(ctx, addr, grpc.WithInsecure(), grpc.WithDialer(dailer), grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(maxMsgSize)))
if err != nil {
return nil, err
}
Expand Down
1 change: 0 additions & 1 deletion helper/envconfig/docker_env_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import (
docker "github.com/fsouza/go-dockerclient"
)

//
var K8sFlag = flag.Bool("ALICLOUD_LOG_K8S_FLAG", false, "alibaba log k8s event config flag, set true if you want to use it")

// DockerConfigInitFlag is the alibaba log docker env config flag, set yes if you want to use it. And it is also a special flag to control enable go part in ilogtail. If you just want to
Expand Down
1 change: 1 addition & 0 deletions helper/envconfig/product_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ func recorrectRegion(region string) string {
}

// CreateProductLogstore create product logstore
//
// "cn-hangzhou"
// "test-hangzhou-project"
// "audit-logstore"
Expand Down
6 changes: 4 additions & 2 deletions helper/meta_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ type MetaNode struct {
Parents Parents
}

//easyjson:json
// Attributes used to store attributes in common conditions.
//
//easyjson:json
type Attributes map[string]interface{}

//easyjson:json
Expand Down Expand Up @@ -99,8 +100,9 @@ func AddMetadata(collector ilogtail.Collector, time time.Time, node *MetaNode) {
collector.AddDataArray(nil, keys, vals, time)
}

//nolint:gosec
// makeMetaLog convert MetaNode to the log of Logtail
//
//nolint:gosec
func makeMetaLog(node *MetaNode) (keys, values []string) {
values = make([]string, 5)
values[0] = node.ID
Expand Down
2 changes: 1 addition & 1 deletion helper/probe_http.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func init() {
if err != nil {
return
}
server := &http.Server{
server := &http.Server{ //nolint:gosec
Addr: ":" + strconv.Itoa(checkPort),
}
mux := http.NewServeMux()
Expand Down
18 changes: 17 additions & 1 deletion pkg/go.mod
Original file line number Diff line number Diff line change
@@ -1,10 +1,26 @@
module github.com/alibaba/ilogtail/pkg

go 1.16
go 1.18

require (
github.com/cihub/seelog v0.0.0-20170130134532-f561c5e57575
github.com/gogo/protobuf v1.3.2
github.com/smartystreets/goconvey v1.7.2
github.com/stretchr/testify v1.7.0
google.golang.org/grpc v1.40.0
)

require (
github.com/davecgh/go-spew v1.1.0 // indirect
github.com/golang/protobuf v1.4.3 // indirect
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 // indirect
github.com/jtolds/gls v4.20.0+incompatible // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/smartystreets/assertions v1.2.0 // indirect
golang.org/x/net v0.0.0-20201021035429-f5854403a974 // indirect
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f // indirect
golang.org/x/text v0.3.3 // indirect
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 // indirect
google.golang.org/protobuf v1.25.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect
)
9 changes: 9 additions & 0 deletions pkg/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,21 @@ github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w=
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
github.com/smartystreets/assertions v1.2.0 h1:42S6lae5dvLc7BrLu/0ugRtcFVjoJNMC/N3yZFZkDFs=
github.com/smartystreets/assertions v1.2.0/go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYlVhC/LOxJk7iOWnoo=
github.com/smartystreets/goconvey v1.7.2 h1:9RBaZCeXEQ3UselpuwUQHltGVXvdwm6cv1hgR6gDIPg=
github.com/smartystreets/goconvey v1.7.2/go.mod h1:Vw0tHAZW6lzCRk3xgdin6fKYcG+G3Pg9vgXWeJpQFMM=
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
Expand Down Expand Up @@ -99,6 +107,7 @@ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGm
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
Expand Down
26 changes: 14 additions & 12 deletions pkg/protocol/sls_logs.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion plugin_main/plugin_http.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"io"
"io/ioutil"
"net/http"
_ "net/http/pprof" //nolint:gosec
_ "net/http/pprof"
"os"
"runtime"
"runtime/debug"
Expand Down
8 changes: 4 additions & 4 deletions plugins/flusher/sls/flusher_sls.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
)

// SlsFlusher uses symbols in LogtailAdaptor(.so) to flush log groups to Logtail.
type SlsFlusher struct {
type SlsFlusher struct { // nolint:revive
EnableShardHash bool
KeepShardHash bool

Expand Down Expand Up @@ -100,9 +100,9 @@ func (p *SlsFlusher) Flush(projectName string, logstoreName string, configName s

// SetUrgent ...
// We do nothing here because necessary flag has already been set in Logtail
// before this method is called. Any future call of IsReady will return
// true so that remaining data can be flushed to Logtail (which will flush
// data to local file system) before it quits.
// before this method is called. Any future call of IsReady will return
// true so that remaining data can be flushed to Logtail (which will flush
// data to local file system) before it quits.
func (*SlsFlusher) SetUrgent(flag bool) {
}

Expand Down
2 changes: 1 addition & 1 deletion plugins/input/canal/input_canal.go
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ func (sc *ServiceCanal) getLatestGTID() (mysql.GTIDSet, error) {

// newCanal is a wrapper of canal.NewCanal with retry logic (every 5 seconds).
// @return bool to indicate if the shutdown has signaled. non-nil error if
// NewCanal failed because of non-ROW mode.
// NewCanal failed because of non-ROW mode.
func (sc *ServiceCanal) newCanal() (bool, error) {
var err error
for {
Expand Down
3 changes: 1 addition & 2 deletions plugins/input/example/metric_example.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ func (m *MetricsExample) Collect(collector ilogtail.Collector) error {
// counter increment
m.counter++
// create a random value as gauge value
//nolint:gosec
m.gauge = rand.Intn(100)
m.gauge = rand.Intn(100) //nolint:gosec

// collect the metrics
helper.AddMetric(collector, "example_counter", time.Now(), m.labels, float64(m.counter))
Expand Down
2 changes: 1 addition & 1 deletion plugins/input/journal/unit.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func (sj *ServiceJournal) addMatchesForUnit(unit string) error {
// /blah/blah is converted to blah-blah.mount, anything else is left alone,
// except that "suffix" is appended if a valid unit suffix is not present.

// If allowGlobs, globs characters are preserved. Otherwise, they are escaped.
// If allowGlobs, globs characters are preserved. Otherwise, they are escaped.
func unitNameMangle(name, suffix string) (string, error) {
// Can't be empty or begin with a dot
if len(name) == 0 || name[0] == '.' {
Expand Down
2 changes: 1 addition & 1 deletion plugins/input/lumberjack/input_lumberjack.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
// server supports all lumberjack protocol versions, which must be explicitly enabled
// from command line. For printing list of known command line flags run:
//
// tst-lj -h
// tst-lj -h
package lumberjack

import (
Expand Down
2 changes: 1 addition & 1 deletion plugins/input/process/input_process_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (t *TestProcessCache) Labels(values helper.KeyValues) string {
return ""
}

func (t *TestProcessCache) GetProcessStatus() *processStatus {
func (t *TestProcessCache) GetProcessStatus() *processStatus { // nolint:revive
return t.processStatus
}

Expand Down
1 change: 0 additions & 1 deletion plugins/input/prometheus/sls_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ func formatLabelValue(value string) string {
return string(newValue)
}

// //nolint:gosec
func formatNewMetricName(name string) string {
newName := []byte(name)
for i, b := range newName {
Expand Down
2 changes: 1 addition & 1 deletion plugins/input/rdb/pgsql/pgsql.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"strconv"
"strings"

_ "github.com/jackc/pgx/v4/stdlib" //nolint
_ "github.com/jackc/pgx/v4/stdlib" //

"github.com/alibaba/ilogtail"
"github.com/alibaba/ilogtail/pkg/util"
Expand Down
2 changes: 1 addition & 1 deletion plugins/input/rdb/rdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
"github.com/alibaba/ilogtail/pkg/logger"
)

type RdbFunc func() error
type RdbFunc func() error //nolint:revive

type ColumnResolverFunc func(string) (string, error)

Expand Down
4 changes: 3 additions & 1 deletion plugins/input/redis/input_redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,9 @@ func gatherInfoOutput(

// Parse the special Keyspace line at end of redis stats
// This is a special line that looks something like:
// db0:keys=2,expires=0,avg_ttl=0
//
// db0:keys=2,expires=0,avg_ttl=0
//
// And there is one for each db on the redis instance
func gatherKeyspaceLine(name, line string, fields *map[string]string, dbTotal *TotalDBInfo) {
if strings.Contains(line, "keys=") {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.