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

Fix linter warnings #156

Merged
merged 2 commits into from
Jan 20, 2023
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion change_version.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#/bin/bash
#!/bin/bash
echo $1 > VERSION
sed -i -e "s/.*buildVersion = \"*.*/buildVersion = \"$1\"/" ./connection.go
go fmt ./...
2 changes: 1 addition & 1 deletion connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ func (c *Connection) closeWith(err *Error) error {
// IsClosed returns true if the connection is marked as closed, otherwise false
// is returned.
func (c *Connection) IsClosed() bool {
return (atomic.LoadInt32(&c.closed) == 1)
return atomic.LoadInt32(&c.closed) == 1
}

func (c *Connection) send(f frame) error {
Expand Down
31 changes: 10 additions & 21 deletions integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -819,7 +819,7 @@ func TestIntegrationConsumeCancel(t *testing.T) {
}
}

func (c *Connection) Generate(r *rand.Rand, _ int) reflect.Value {
func (c *Connection) Generate(_ *rand.Rand, _ int) reflect.Value {
urlStr := amqpURL

conn, err := Dial(urlStr)
Expand Down Expand Up @@ -1259,22 +1259,22 @@ func TestIntegrationCancel(t *testing.T) {
defer c.Close()

cancels := ch.NotifyCancel(make(chan string, 1))
consume_err := make(chan error, 1)
delete_err := make(chan error, 1)
consumeErr := make(chan error, 1)
deleteErr := make(chan error, 1)

go func() {
if _, err := ch.Consume(queue, consumerTag, false, false, false, false, nil); err != nil {
consume_err <- err
consumeErr <- err
}
if _, err := ch.QueueDelete(queue, false, false, false); err != nil {
delete_err <- err
deleteErr <- err
}
}()

select {
case err := <-consume_err:
case err := <-consumeErr:
t.Fatalf("cannot consume from %q to test NotifyCancel: %v", queue, err)
case err := <-delete_err:
case err := <-deleteErr:
t.Fatalf("cannot delete integration queue: %v", err)
case tag := <-cancels:
if want, got := consumerTag, tag; want != got {
Expand Down Expand Up @@ -1445,11 +1445,11 @@ func TestDeclareArgsRejectToDeadLetterQueue(t *testing.T) {
}

// Reject everything consumed
reject_errs := make(chan error, len(fails))
rejectErrs := make(chan error, len(fails))
go func() {
for d := range fails {
if err := d.Reject(false); err != nil {
reject_errs <- err
rejectErrs <- err
}
}
}()
Expand Down Expand Up @@ -1479,16 +1479,6 @@ func TestDeclareArgsRejectToDeadLetterQueue(t *testing.T) {
}
}
t.Fatalf("expected dead-letter after 10 get attempts")

if err := ch.Close(); err != nil {
t.Fatalf("channel close error: %v", err)
}
close(reject_errs)
for err := range reject_errs {
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
}
}
}

Expand Down Expand Up @@ -1915,7 +1905,6 @@ func TestConsumerCancelNotification(t *testing.T) {
// do nothing
case <-time.After(time.Second * 10):
t.Fatalf("basic.cancel wasn't received")
t.Fail()
}
// we don't close ccnChan because channel shutdown
// does it
Expand Down Expand Up @@ -2058,7 +2047,7 @@ func integrationQueueDelete(t *testing.T, c *Channel, queue string) {
// Delegates to integrationConnection and only returns a connection if the
// product is RabbitMQ
func integrationRabbitMQ(t *testing.T, name string) *Connection {
if conn := integrationConnection(t, "connect"); conn != nil {
if conn := integrationConnection(t, name); conn != nil {
if server, ok := conn.Properties["product"]; ok && server == "RabbitMQ" {
return conn
}
Expand Down
2 changes: 1 addition & 1 deletion read.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ func readField(r io.Reader) (v interface{}, err error) {
if err = binary.Read(r, binary.BigEndian, &value); err != nil {
return
}
return (value != 0), nil
return value != 0, nil

case 'B':
var value [1]byte
Expand Down