Skip to content

Commit

Permalink
fix based on golint
Browse files Browse the repository at this point in the history
  • Loading branch information
Shu Kutsuzawa committed Feb 22, 2021
1 parent 8a30c2b commit 3797b35
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ type Asset struct {
Shasum string `yaml:"shasum" json:"shasum"`
}

// Source desribes source for provider
// Source describes source for provider
type Source struct {
DownloadURL string `yaml:"download_url"`
}

// Module decribes config for module
// Module describes config for module
type Module struct{}

// Parse parse yaml file to go struct
Expand Down
4 changes: 4 additions & 0 deletions internal/http/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ import (
"github.com/go-chi/chi"
)

// Server describes the http server
type Server struct {
server *http.Server
}

// NewServer initializes the http server
func NewServer(port int, c *config.Config) *Server {
r := chi.NewRouter()
registerRoute(r, c)
Expand Down Expand Up @@ -57,6 +59,7 @@ func registerRoute(r *chi.Mux, c *config.Config) {
})
}

// Start starts the http server
func (s *Server) Start() error {
if err := s.server.ListenAndServe(); err != nil && err != http.ErrServerClosed {
return fmt.Errorf("http server ListenAndServe: %v", err)
Expand All @@ -65,6 +68,7 @@ func (s *Server) Start() error {
return nil
}

// Stop stops the http server
func (s *Server) Stop(ctx context.Context) error {
if err := s.server.Shutdown(ctx); err != nil {
return fmt.Errorf("http server Shutdown: %v", err)
Expand Down
2 changes: 2 additions & 0 deletions internal/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ import (
"github.com/cappyzawa/terraform-registry/internal/http"
)

// Opt has options for the server
type Opt struct {
ConfigPATH string
PIDPATH string
}

// Run runs the server
func Run(opt *Opt) {
os.Exit(run(context.Background(), opt))
}
Expand Down

0 comments on commit 3797b35

Please sign in to comment.