[#58] Update methods for golint

This patch addresses golint failures such as:
pkg/bootstrap/isogen/command_test.go:43:26: method GetId should be GetID
pkg/container/container_docker.go:171:27: method getImageId should be
getImageID
pkg/container/container_docker.go:193:27: method GetId should be GetID

Relates-To: #58

Change-Id: I7eb461387524f23a89bc2ae7ce59dac066c12281
Signed-off-by: Alexander Hughes <Alexander.Hughes@pm.me>
This commit is contained in:
Alexander Hughes 2020-02-28 10:31:45 -05:00
parent 0a4764e93a
commit cc90889dd0
5 changed files with 9 additions and 9 deletions

View File

@ -151,6 +151,6 @@ func generateBootstrapIso(
return builder.RmContainer() return builder.RmContainer()
} }
log.Debugf("Debug flag is set. Container %s stopped but not deleted.", builder.GetId()) log.Debugf("Debug flag is set. Container %s stopped but not deleted.", builder.GetID())
return nil return nil
} }

View File

@ -40,7 +40,7 @@ func (mc *mockContainer) RmContainer() error {
return mc.rmContainer() return mc.rmContainer()
} }
func (mc *mockContainer) GetId() string { func (mc *mockContainer) GetID() string {
return mc.getID() return mc.getID()
} }

View File

@ -13,7 +13,7 @@ type Container interface {
RunCommand([]string, io.Reader, []string, []string, bool) error RunCommand([]string, io.Reader, []string, []string, bool) error
RunCommandOutput([]string, io.Reader, []string, []string) (io.ReadCloser, error) RunCommandOutput([]string, io.Reader, []string, []string) (io.ReadCloser, error)
RmContainer() error RmContainer() error
GetId() string GetID() string
} }
// NewContainer returns instance of Container interface implemented by particular driver // NewContainer returns instance of Container interface implemented by particular driver

View File

@ -134,7 +134,7 @@ func (c *DockerContainer) getCmd(cmd []string) ([]string, error) {
return cmd, nil return cmd, nil
} }
id, err := c.getImageId(c.imageURL) id, err := c.getImageID(c.imageURL)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -166,9 +166,9 @@ func (c *DockerContainer) getConfig(
return cCfg, hCfg return cCfg, hCfg
} }
// getImageId return ID of container image specified by URL. Method executes // getImageID return ID of container image specified by URL. Method executes
// ImageList function supplied with "reference" filter // ImageList function supplied with "reference" filter
func (c *DockerContainer) getImageId(url string) (string, error) { func (c *DockerContainer) getImageID(url string) (string, error) {
kv := filters.KeyValuePair{ kv := filters.KeyValuePair{
Key: "reference", Key: "reference",
Value: url, Value: url,
@ -190,7 +190,7 @@ func (c *DockerContainer) getImageId(url string) (string, error) {
return img[0].ID, nil return img[0].ID, nil
} }
func (c *DockerContainer) GetId() string { func (c *DockerContainer) GetID() string {
return c.id return c.id
} }

View File

@ -200,7 +200,7 @@ func TestGetImageId(t *testing.T) {
} }
for _, tt := range tests { for _, tt := range tests {
cnt := getDockerContainerMock(tt.mockDockerClient) cnt := getDockerContainerMock(tt.mockDockerClient)
actualRes, actualErr := cnt.getImageId(tt.url) actualRes, actualErr := cnt.getImageID(tt.url)
assert.Equal(t, tt.expectedErr, actualErr) assert.Equal(t, tt.expectedErr, actualErr)
assert.Equal(t, tt.expectedResult, actualRes) assert.Equal(t, tt.expectedResult, actualRes)
@ -242,7 +242,7 @@ func TestGetId(t *testing.T) {
cnt := getDockerContainerMock(mockDockerClient{}) cnt := getDockerContainerMock(mockDockerClient{})
err := cnt.RunCommand([]string{"testCmd"}, nil, nil, []string{}, false) err := cnt.RunCommand([]string{"testCmd"}, nil, nil, []string{}, false)
require.NoError(t, err) require.NoError(t, err)
actualID := cnt.GetId() actualID := cnt.GetID()
assert.Equal(t, "testID", actualID) assert.Equal(t, "testID", actualID)
} }