Skip to content

Commit

Permalink
refactor(all): small refactor (#192)
Browse files Browse the repository at this point in the history
refactor: code cleanup
  • Loading branch information
sashamelentyev authored Dec 24, 2021
1 parent bc56faa commit c8a5f24
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion command/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ var installCmd = &cobra.Command{
Use: "install",
Short: "Check required tools",
Long: "Checks versions of required Pact CLI tools for used by the library",
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
setLogLevel(verbose, logLevel)

// Run the installer
Expand Down
2 changes: 1 addition & 1 deletion command/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var versionCmd = &cobra.Command{
Use: "version",
Short: "Print the version number of Pact Go",
Long: `All software has versions. This is Pact Go's`,
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
fmt.Printf("Pact Go CLI %s, using CLI tools version %s", version, cliToolsVersion)
},
}
Expand Down
2 changes: 1 addition & 1 deletion dsl/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func (p *PactClient) StopServer(server *types.MockServer) (*types.MockServer, er
}

// RemoveAllServers stops all remote Pact Mock Servers.
func (p *PactClient) RemoveAllServers(server *types.MockServer) []*types.MockServer {
func (p *PactClient) RemoveAllServers(_ *types.MockServer) []*types.MockServer {
log.Println("[DEBUG] client: stop server")

for _, s := range p.verificationSvcManager.List() {
Expand Down
2 changes: 1 addition & 1 deletion dsl/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ type State struct {

// Given specifies a provider state. Optional.
func (p *Message) Given(state string) *Message {
p.States = []State{State{Name: state}}
p.States = []State{{Name: state}}

return p
}
Expand Down
14 changes: 7 additions & 7 deletions dsl/mock_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func newMockClient() *mockClient {
}

// StartServer starts a remote Pact Mock Server.
func (p *mockClient) StartServer(args []string, port int) *types.MockServer {
func (p *mockClient) StartServer(_ []string, _ int) *types.MockServer {
return p.MockServer
}

Expand All @@ -44,33 +44,33 @@ func (p *mockClient) ListServers() []*types.MockServer {
}

// StopServer stops a remote Pact Mock Server.
func (p *mockClient) StopServer(server *types.MockServer) (*types.MockServer, error) {
func (p *mockClient) StopServer(_ *types.MockServer) (*types.MockServer, error) {
return p.StopServerResponse, p.StopServerError
}

// RemoveAllServers stops all remote Pact Mock Servers.
func (p *mockClient) RemoveAllServers(server *types.MockServer) []*types.MockServer {
func (p *mockClient) RemoveAllServers(_ *types.MockServer) []*types.MockServer {
return p.RemoveAllServersResponse
}

// VerifyProvider runs the verification process against a running Provider.
func (p *mockClient) VerifyProvider(request types.VerifyRequest) ([]types.ProviderVerifierResponse, error) {
func (p *mockClient) VerifyProvider(_ types.VerifyRequest) ([]types.ProviderVerifierResponse, error) {
return p.VerifyProviderResponse, p.VerifyProviderError
}

// UpdateMessagePact adds a pact message to a contract file
func (p *mockClient) UpdateMessagePact(request types.PactMessageRequest) error {
func (p *mockClient) UpdateMessagePact(_ types.PactMessageRequest) error {
return p.UpdateMessagePactError
}

// ReifyMessage takes a structured object, potentially containing nested Matchers
// and returns an object with just the example (generated) content
// The object may be a simple JSON primitive e.g. string or number or a complex object
func (p *mockClient) ReifyMessage(request *types.PactReificationRequest) (res *types.ReificationResponse, err error) {
func (p *mockClient) ReifyMessage(_ *types.PactReificationRequest) (res *types.ReificationResponse, err error) {
return p.ReifyMessageResponse, p.ReifyMessageError
}

// PublishPacts publishes pacts to a broker
func (p *mockClient) PublishPacts(request types.PublishRequest) error {
func (p *mockClient) PublishPacts(_ types.PublishRequest) error {
return p.PublishPactsError
}
2 changes: 1 addition & 1 deletion dsl/service_mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,6 @@ func (s *ServiceMock) Command() *exec.Cmd {
}

// NewService creates a new MockService with default settings.
func (s *ServiceMock) NewService(args []string) client.Service {
func (s *ServiceMock) NewService(_ []string) client.Service {
return s
}

0 comments on commit c8a5f24

Please sign in to comment.