Skip to content

Commit

Permalink
Add comments for golint
Browse files Browse the repository at this point in the history
  • Loading branch information
whywaita committed Dec 6, 2021
1 parent 0709d93 commit 0009003
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions server/pkg/api/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"google.golang.org/grpc"
)

// ShoesLXDMultiServer implement gRPC server
type ShoesLXDMultiServer struct {
pb.UnimplementedShoesLXDMultiServer

Expand Down
2 changes: 2 additions & 0 deletions server/pkg/api/server_add_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"google.golang.org/grpc/status"
)

// AddInstance add instance to LXD server
func (s *ShoesLXDMultiServer) AddInstance(ctx context.Context, req *pb.AddInstanceRequest) (*pb.AddInstanceResponse, error) {
log.Printf("AddInstance req: %+v\n", req)
if _, err := runner.ToUUID(req.RunnerName); err != nil {
Expand Down Expand Up @@ -133,6 +134,7 @@ func (s *ShoesLXDMultiServer) scheduleHost(targetLXDHosts []lxdclient.LXDHost) (
}

var (
// ErrNoValidHost is not valid host in targets
ErrNoValidHost = fmt.Errorf("no valid host in targets")
)

Expand Down
1 change: 1 addition & 0 deletions server/pkg/api/server_delete_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"google.golang.org/grpc/status"
)

// DeleteInstance delete instance to LXD server
func (s *ShoesLXDMultiServer) DeleteInstance(ctx context.Context, req *pb.DeleteInstanceRequest) (*pb.DeleteInstanceResponse, error) {
log.Printf("DeleteInstance req: %+v\n", req)
if _, err := runner.ToUUID(req.CloudId); err != nil {
Expand Down
5 changes: 5 additions & 0 deletions server/pkg/config/config_hostconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,20 @@ type HostConfigMap struct {
s sync.Map
}

// ErrHostNotFound is error message for host config is not found
var ErrHostNotFound = fmt.Errorf("host config is not found")

// NewHostConfigMap create config map for host config
func NewHostConfigMap() *HostConfigMap {
return &HostConfigMap{}
}

// Store host config
func (s *HostConfigMap) Store(lxdAPIAddress string, hostConfig HostConfig) {
s.s.Store(lxdAPIAddress, hostConfig)
}

// Load host config
func (s *HostConfigMap) Load(lxdAPIAddress string) (*HostConfig, error) {
v, ok := s.s.Load(lxdAPIAddress)
if !ok {
Expand All @@ -37,6 +41,7 @@ func (s *HostConfigMap) Load(lxdAPIAddress string) (*HostConfig, error) {
return &t, nil
}

// Range host config
func (s *HostConfigMap) Range(f func(key string, value HostConfig) bool) {
s.s.Range(func(key, value interface{}) bool {
k := key.(string)
Expand Down
1 change: 1 addition & 0 deletions server/pkg/lxdclient/connect.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ func ConnectLXDs(hostConfigs []config.HostConfig) ([]LXDHost, error) {
}

var (
// ErrTimeoutConnectLXD is error message for timeout of ConnectLXD
ErrTimeoutConnectLXD = fmt.Errorf("timeout of ConnectLXD")
)

Expand Down
4 changes: 3 additions & 1 deletion shoes-lxd-multi/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ import (
)

const (
EnvTargetHosts = "LXD_MULTI_TARGET_HOSTS"
// EnvTargetHosts is list of target host
EnvTargetHosts = "LXD_MULTI_TARGET_HOSTS"
// EnvServerEndpoint is endpoint of server
EnvServerEndpoint = "LXD_MULTI_SERVER_ENDPOINT"
)

Expand Down

0 comments on commit 0009003

Please sign in to comment.