Browse Source

Style: use gofumpt for fmt

pull/133/head
xjasonlyu 3 years ago
parent
commit
e23837aa6d
  1. 5
      .github/workflows/go.yml
  2. 3
      Makefile
  3. 2
      common/observable/observable_test.go
  4. 1
      common/pool/alloc.go
  5. 4
      component/dialer/control.go
  6. 6
      log/log.go
  7. 4
      proxy/proxy.go
  8. 2
      proxy/socks5.go

5
.github/workflows/go.yml

@ -34,6 +34,5 @@ jobs:
- name: Get dependencies, run test and static check
run: |
go test ./...
go vet ./...
go install honnef.co/go/tools/cmd/staticcheck@latest
staticcheck -- $(go list ./...)
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
golangci-lint run --disable-all -E govet -E gofumpt -E megacheck ./...

3
Makefile

@ -151,5 +151,8 @@ all-arch: $(UNIX_ARCH_LIST) $(WINDOWS_ARCH_LIST)
releases: $(unix_releases) $(windows_releases)
lint:
golangci-lint run --disable-all -E govet -E gofumpt -E megacheck ./...
clean:
rm -rf $(BUILD_DIR)

2
common/observable/observable_test.go

@ -38,7 +38,7 @@ func TestObservable_MultiSubscribe(t *testing.T) {
src := NewObservable(iter)
ch1, _ := src.Subscribe()
ch2, _ := src.Subscribe()
var count = atomic.NewInt32(0)
count := atomic.NewInt32(0)
var wg sync.WaitGroup
wg.Add(2)

1
common/pool/alloc.go

@ -52,6 +52,7 @@ func (alloc *Allocator) Put(buf []byte) error {
}
//lint:ignore SA6002 ignore temporarily
//nolint
alloc.buffers[b].Put(buf)
return nil
}

4
component/dialer/control.go

@ -8,9 +8,7 @@ import (
type controlFunc func(string, string, syscall.RawConn) error
var (
_controlPool = make([]controlFunc, 0, 2)
)
var _controlPool = make([]controlFunc, 0, 2)
func addControl(f controlFunc) {
_controlPool = append(_controlPool, f)

6
log/log.go

@ -7,10 +7,8 @@ import (
"go.uber.org/atomic"
)
var (
// _defaultLevel is package default logging level.
_defaultLevel = atomic.NewUint32(uint32(InfoLevel))
)
// _defaultLevel is package default logging level.
var _defaultLevel = atomic.NewUint32(uint32(InfoLevel))
func init() {
logrus.SetOutput(os.Stdout)

4
proxy/proxy.go

@ -14,9 +14,7 @@ const (
tcpConnectTimeout = 5 * time.Second
)
var (
_defaultDialer Dialer = &Base{}
)
var _defaultDialer Dialer = &Base{}
type Dialer interface {
DialContext(context.Context, *M.Metadata) (net.Conn, error)

2
proxy/socks5.go

@ -38,7 +38,7 @@ func NewSocks5(addr, user, pass string) (*Socks5, error) {
}
func (ss *Socks5) DialContext(ctx context.Context, metadata *M.Metadata) (c net.Conn, err error) {
var network = "tcp"
network := "tcp"
if ss.unix {
network = "unix"
}

Loading…
Cancel
Save