Skip to content

Commit c488a5e

Browse files
committed
golangci-lint fixes: add package comments and fix lint issues
1 parent c5c30e2 commit c488a5e

14 files changed

Lines changed: 25 additions & 14 deletions

File tree

cmd/flexctl/backups.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ func getAppName() (string, error) {
254254
return name, nil
255255
}
256256

257-
func getApiUrl() (string, error) {
257+
func getAPIURL() (string, error) {
258258
hostname, err := getAppName()
259259
if err != nil {
260260
return "", err
@@ -273,7 +273,7 @@ func newConfigShow() *cobra.Command {
273273
return fmt.Errorf("backups are not enabled")
274274
}
275275

276-
url, err := getApiUrl()
276+
url, err := getAPIURL()
277277
if err != nil {
278278
return err
279279
}
@@ -283,6 +283,7 @@ func newConfigShow() *cobra.Command {
283283
if err != nil {
284284
return err
285285
}
286+
defer resp.Body.Close() // nolint:errcheck
286287

287288
var rv configShowResult
288289
if err := json.NewDecoder(resp.Body).Decode(&rv); err != nil {
@@ -354,7 +355,7 @@ func newConfigUpdate() *cobra.Command {
354355
return err
355356
}
356357

357-
url, err := getApiUrl()
358+
url, err := getAPIURL()
358359
if err != nil {
359360
return err
360361
}
@@ -364,6 +365,7 @@ func newConfigUpdate() *cobra.Command {
364365
if err != nil {
365366
return err
366367
}
368+
defer resp.Body.Close() // nolint:errcheck
367369

368370
var rv configUpdateResult
369371
if err := json.NewDecoder(resp.Body).Decode(&rv); err != nil {

internal/api/handler.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Package api provides HTTP handlers for the postgres management API.
12
package api
23

34
import (

internal/flybarman/node.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Package flybarman manages barman backup nodes.
12
package flybarman
23

34
import (

internal/flycheck/barman.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ func CheckBarmanConnection(checks *check.CheckSuite) *check.CheckSuite {
1414

1515
output, err := cmd.CombinedOutput()
1616
if err != nil {
17-
checks.AddCheck("connection", func() (string, error) {
17+
_ = checks.AddCheck("connection", func() (string, error) {
1818
msg := "failed running `barman check pg`"
1919
return "", errors.New(msg)
2020
})
@@ -40,7 +40,7 @@ func CheckBarmanConnection(checks *check.CheckSuite) *check.CheckSuite {
4040
continue
4141
}
4242

43-
checks.AddCheck(left, func() (string, error) {
43+
_ = checks.AddCheck(left, func() (string, error) {
4444
if strings.Contains(right, "FAILED") {
4545
return "", errors.New(right)
4646
}

internal/flycheck/checks.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Package flycheck implements health check handlers for fly.io postgres.
12
package flycheck
23

34
import (

internal/flycheck/pg.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ func CheckPostgreSQL(ctx context.Context, checks *check.CheckSuite) (*check.Chec
4141
_ = repConn.Close(ctx)
4242
}
4343

44-
checks.AddCheck("connections", func() (string, error) {
44+
_ = checks.AddCheck("connections", func() (string, error) {
4545
return connectionCount(ctx, localConn)
4646
})
4747

4848
if member.Role == flypg.PrimaryRoleName {
4949
// Check to see if any locks are present.
50-
checks.AddCheck("cluster-locks", func() (string, error) {
50+
_ = checks.AddCheck("cluster-locks", func() (string, error) {
5151
if flypg.ZombieLockExists() {
5252
return "", fmt.Errorf("`zombie.lock` detected")
5353
}
@@ -62,7 +62,7 @@ func CheckPostgreSQL(ctx context.Context, checks *check.CheckSuite) (*check.Chec
6262
if member.Active {
6363
// Check that provides additional insight into disk capacity and
6464
// how close we are to hitting the readonly threshold.
65-
checks.AddCheck("disk-capacity", func() (string, error) {
65+
_ = checks.AddCheck("disk-capacity", func() (string, error) {
6666
return diskCapacityCheck(ctx, node)
6767
})
6868
}

internal/flycheck/role.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
// PostgreSQLRole outputs current role
1414
func PostgreSQLRole(ctx context.Context, checks *check.CheckSuite) (*check.CheckSuite, error) {
1515
if os.Getenv("IS_BARMAN") != "" {
16-
checks.AddCheck("role", func() (string, error) {
16+
_ = checks.AddCheck("role", func() (string, error) {
1717
return "barman", nil
1818
})
1919

@@ -35,7 +35,7 @@ func PostgreSQLRole(ctx context.Context, checks *check.CheckSuite) (*check.Check
3535
_ = conn.Close(ctx)
3636
}
3737

38-
checks.AddCheck("role", func() (string, error) {
38+
_ = checks.AddCheck("role", func() (string, error) {
3939
if flypg.ZombieLockExists() {
4040
return "zombie", nil
4141
}

internal/flycheck/vm.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,16 @@ import (
1515

1616
// CheckVM for system / disk checks
1717
func CheckVM(checks *check.CheckSuite) *check.CheckSuite {
18-
checks.AddCheck("checkDisk", func() (string, error) {
18+
_ = checks.AddCheck("checkDisk", func() (string, error) {
1919
return checkDisk("/data/")
2020
})
2121

22-
checks.AddCheck("checkLoad", checkLoad)
22+
_ = checks.AddCheck("checkLoad", checkLoad)
2323

2424
pressureNames := []string{"memory", "cpu", "io"}
2525
for _, n := range pressureNames {
2626
name := n
27-
checks.AddCheck(name, func() (string, error) {
27+
_ = checks.AddCheck(name, func() (string, error) {
2828
return checkPressure(name)
2929
})
3030
}

internal/flypg/admin/admin.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Package admin provides administrative utilities for managing postgres.
12
package admin
23

34
import (

internal/flypg/flypg.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Package flypg manages the postgres cluster lifecycle on fly.io.
12
package flypg
23

34
import (

0 commit comments

Comments
 (0)