Apply all golangci-lint fixes
This commit is contained in:
parent
945b3299ac
commit
75910efbe5
8 changed files with 19 additions and 22 deletions
|
@ -47,8 +47,7 @@ func (s *Server) Register(ctx context.Context, req *rove.RegisterRequest) (*rove
|
|||
}
|
||||
|
||||
// Status returns rover information for a gRPC request
|
||||
func (s *Server) Status(ctx context.Context, req *rove.StatusRequest) (*rove.StatusResponse, error) {
|
||||
response := &rove.StatusResponse{}
|
||||
func (s *Server) Status(ctx context.Context, req *rove.StatusRequest) (response *rove.StatusResponse, err error) {
|
||||
if len(req.Account) == 0 {
|
||||
return nil, fmt.Errorf("empty account name")
|
||||
|
||||
|
|
|
@ -136,7 +136,9 @@ func (s *Server) Run() {
|
|||
s.world.ExecuteCommandQueues()
|
||||
|
||||
// Save out the new world state
|
||||
s.SaveWorld()
|
||||
if err := s.SaveWorld(); err != nil {
|
||||
log.Fatalf("Failed to save the world: %s", err)
|
||||
}
|
||||
}); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
|
|
@ -52,7 +52,9 @@ func InnerMain() {
|
|||
log.Printf("Initialising version %s...\n", version.Version)
|
||||
|
||||
// Set the persistence path
|
||||
persistence.SetPath(data)
|
||||
if err := persistence.SetPath(data); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
// Convert the tick rate
|
||||
tickRate := 1
|
||||
|
|
|
@ -3,10 +3,12 @@ package main
|
|||
import (
|
||||
"flag"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func Test_InnerMain_Version(t *testing.T) {
|
||||
flag.Set("version", "1")
|
||||
assert.NoError(t, flag.Set("version", "1"))
|
||||
InnerMain()
|
||||
flag.Set("version", "0")
|
||||
assert.NoError(t, flag.Set("version", "0"))
|
||||
}
|
||||
|
|
|
@ -78,7 +78,9 @@ func LoadConfig() (config Config, err error) {
|
|||
// Create the path if needed
|
||||
path := filepath.Dir(datapath)
|
||||
if _, err := os.Stat(path); os.IsNotExist(err) {
|
||||
os.MkdirAll(path, os.ModePerm)
|
||||
if err := os.MkdirAll(path, os.ModePerm); err != nil {
|
||||
return Config{}, fmt.Errorf("Failed to create data path %s: %s", path, err)
|
||||
}
|
||||
} else {
|
||||
// Read the file
|
||||
_, err = os.Stat(datapath)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue