Skip to content

Commit

Permalink
update golangci-lint (#105)
Browse files Browse the repository at this point in the history
  • Loading branch information
aler9 authored Apr 28, 2024
1 parent 5bd7738 commit 78db919
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 17 deletions.
1 change: 0 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,3 @@ linters-settings:
disable:
- fieldalignment
- reflectvaluecompare
- shadow
4 changes: 2 additions & 2 deletions endpoint_broadcast_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ func TestEndpointBroadcast(t *testing.T) {
rw, err := frame.NewReadWriter(frame.ReadWriterConf{
ReadWriter: &readWriterFromFuncs{
readFunc: func(p []byte) (int, error) {
n, _, err := pc.ReadFrom(p)
return n, err
n, _, err2 := pc.ReadFrom(p)
return n, err2
},
writeFunc: func(p []byte) (int, error) {
return pc.WriteTo(p, &net.UDPAddr{
Expand Down
24 changes: 12 additions & 12 deletions endpoint_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,22 +147,22 @@ func TestEndpointClientIdleTimeout(t *testing.T) {
reconnected := make(chan struct{})

go func() {
conn, err := ln.Accept()
require.NoError(t, err)
conn, err2 := ln.Accept()
require.NoError(t, err2)

dialectRW, err := dialect.NewReadWriter(testDialect)
require.NoError(t, err)
dialectRW, err2 := dialect.NewReadWriter(testDialect)
require.NoError(t, err2)

rw, err := frame.NewReadWriter(frame.ReadWriterConf{
rw, err2 := frame.NewReadWriter(frame.ReadWriterConf{
ReadWriter: conn,
DialectRW: dialectRW,
OutVersion: frame.V2,
OutSystemID: 11,
})
require.NoError(t, err)
require.NoError(t, err2)

fr, err := rw.Read()
require.NoError(t, err)
fr, err2 := rw.Read()
require.NoError(t, err2)
require.Equal(t, &frame.V2Frame{
SequenceNumber: 0,
SystemID: 10,
Expand All @@ -178,15 +178,15 @@ func TestEndpointClientIdleTimeout(t *testing.T) {
Checksum: fr.GetChecksum(),
}, fr)

_, err = rw.Read()
require.Equal(t, io.EOF, err)
_, err2 = rw.Read()
require.Equal(t, io.EOF, err2)
conn.Close()

close(closed)

// the client reconnects to the server due to autoReconnector
conn, err = ln.Accept()
require.NoError(t, err)
conn, err2 = ln.Accept()
require.NoError(t, err2)
conn.Close()

close(reconnected)
Expand Down
3 changes: 2 additions & 1 deletion endpoint_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ func initEndpointServer(node *Node, conf endpointServerConf) (Endpoint, error) {

var ln net.Listener
if conf.isUDP() {
addr, err := net.ResolveUDPAddr("udp4", conf.getAddress())
var addr *net.UDPAddr
addr, err = net.ResolveUDPAddr("udp4", conf.getAddress())
if err != nil {
return nil, err
}
Expand Down
3 changes: 2 additions & 1 deletion pkg/conversion/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,8 @@ func Convert(path string, link bool) error {
isRemote := (err == nil)
defName := defAddrToName(path)

if _, err := os.Stat(defName); !os.IsNotExist(err) {
_, err = os.Stat(defName)
if !os.IsNotExist(err) {
return fmt.Errorf("directory '%s' already exists", defName)
}

Expand Down

0 comments on commit 78db919

Please sign in to comment.