From 6dce0d98c10d511689adb43c6b30beff6f09d895 Mon Sep 17 00:00:00 2001 From: Loyalsoldier <10487845+Loyalsoldier@users.noreply.github.com> Date: Sun, 1 May 2022 01:17:49 +0800 Subject: [PATCH] Fix: format & lint (#1759) * Fix: gci command for formatting code * Chore: format code * Fix: replace golint with revive --- .github/linters/.golangci.yml | 12 +++++++----- infra/vformat/main.go | 8 ++++++-- proxy/vmess/encoding/commands_test.go | 2 +- transport/internet/headers/http/linkedreadRequest.go | 2 -- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/.github/linters/.golangci.yml b/.github/linters/.golangci.yml index 22829352e..332f8cff3 100644 --- a/.github/linters/.golangci.yml +++ b/.github/linters/.golangci.yml @@ -2,14 +2,12 @@ run: timeout: 5m skip-files: - generated.* - issues: new: true exclude-rules: - linters: - - staticcheck + - staticcheck text: "SA1019:" - linters: enable: - asciicheck @@ -19,13 +17,13 @@ linters: - gofmt - gofumpt - goimports - - golint - goprintffuncname - gosimple - govet - ineffassign - misspell - nakedret + - revive - rowserrcheck - staticcheck - structcheck @@ -39,7 +37,11 @@ linters: - deadcode - errcheck - unused - linters-settings: goimports: local-prefixes: github.com/v2fly/v2ray-core + revive: + rules: + - name: blank-imports + severity: warning + disabled: true diff --git a/infra/vformat/main.go b/infra/vformat/main.go index 6e895e59f..30197420c 100644 --- a/infra/vformat/main.go +++ b/infra/vformat/main.go @@ -170,8 +170,12 @@ func main() { } goimportsArgs := []string{ - "-w", - "-local", "github.com/v2fly/v2ray-core", + "write", + "--NoInlineComments", + "--NoPrefixComments", + "--Section", "Standard", + "--Section", "Default", + "--Section", "pkgPrefix(github.com/v2fly/v2ray-core)", } RunMany(gofmt, gofmtArgs, rawFilesSlice) diff --git a/proxy/vmess/encoding/commands_test.go b/proxy/vmess/encoding/commands_test.go index 4c85bfcb5..cb9cc8f88 100644 --- a/proxy/vmess/encoding/commands_test.go +++ b/proxy/vmess/encoding/commands_test.go @@ -1,10 +1,10 @@ package encoding_test import ( - "github.com/stretchr/testify/assert" "testing" "github.com/google/go-cmp/cmp" + "github.com/stretchr/testify/assert" "github.com/v2fly/v2ray-core/v4/common" "github.com/v2fly/v2ray-core/v4/common/buf" diff --git a/transport/internet/headers/http/linkedreadRequest.go b/transport/internet/headers/http/linkedreadRequest.go index 35154b871..1b7fc3607 100644 --- a/transport/internet/headers/http/linkedreadRequest.go +++ b/transport/internet/headers/http/linkedreadRequest.go @@ -3,8 +3,6 @@ package http import ( "bufio" "net/http" - - // required to use go:linkname _ "unsafe" )