diff --git a/Makefile b/Makefile index 74012544d51..8e6ce93da1b 100644 --- a/Makefile +++ b/Makefile @@ -277,6 +277,9 @@ importcheck: .PHONY: static-check static-check: gocyclo govet importcheck + # check for unused code using staticcheck binary + # https://github.com/dominikh/go-tools/tree/master/cmd/staticcheck + staticcheck -tests=false -checks "U1000" ./agent/... .PHONY: goimports goimports: @@ -287,6 +290,7 @@ goimports: go get github.com/golang/mock/mockgen go get golang.org/x/tools/cmd/goimports go get github.com/fzipp/gocyclo + go get honnef.co/go/tools/cmd/staticcheck touch .get-deps-stamp get-deps: .get-deps-stamp diff --git a/agent/acs/handler/payload_handler.go b/agent/acs/handler/payload_handler.go index e4f81aee9ae..126466e5427 100644 --- a/agent/acs/handler/payload_handler.go +++ b/agent/acs/handler/payload_handler.go @@ -277,8 +277,7 @@ func (payloadHandler *payloadRequestHandler) addPayloadTasks(payload *ecsacs.Pay } // Construct a slice with credentials acks from all tasks - var credentialsAcks []*ecsacs.IAMRoleCredentialsAckRequest - credentialsAcks = append(stoppedTasksCredentialsAcks, newTasksCredentialsAcks...) + credentialsAcks := append(stoppedTasksCredentialsAcks, newTasksCredentialsAcks...) return credentialsAcks, allTasksOK } diff --git a/agent/api/container/container.go b/agent/api/container/container.go index eda464063b5..01e610c019b 100644 --- a/agent/api/container/container.go +++ b/agent/api/container/container.go @@ -497,11 +497,7 @@ func (c *Container) GetNextKnownStateProgression() apicontainerstatus.ContainerS // IsInternal returns true if the container type is `ContainerCNIPause` // or `ContainerNamespacePause`. It returns false otherwise func (c *Container) IsInternal() bool { - if c.Type == ContainerNormal { - return false - } - - return true + return c.Type != ContainerNormal } // IsRunning returns true if the container's known status is either RUNNING diff --git a/agent/api/task/task.go b/agent/api/task/task.go index e72bd4c3705..74b8772a53e 100644 --- a/agent/api/task/task.go +++ b/agent/api/task/task.go @@ -2586,15 +2586,6 @@ func (task *Task) GetContainerIndex(containerName string) int { return -1 } -func (task *Task) requireEnvfiles() bool { - for _, container := range task.Containers { - if container.ShouldCreateWithEnvFiles() { - return true - } - } - return false -} - func (task *Task) initializeEnvfilesResource(config *config.Config, credentialsManager credentials.Manager) error { for _, container := range task.Containers { diff --git a/agent/api/task/task_linux.go b/agent/api/task/task_linux.go index c22961cd905..51117bbf841 100644 --- a/agent/api/task/task_linux.go +++ b/agent/api/task/task_linux.go @@ -33,7 +33,6 @@ import ( ) const ( - defaultCPUPeriod = 100 * time.Millisecond // 100ms // With a 100ms CPU period, we can express 0.01 vCPU to 10 vCPUs maxTaskVCPULimit = 10 // Reference: http://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_ContainerDefinition.html @@ -231,11 +230,6 @@ func (task *Task) initializeCredentialSpecResource(config *config.Config, creden return errors.New("task credentialspec is only supported on windows") } -// getAllCredentialSpecRequirements is used to build all the credential spec requirements for the task -func (task *Task) getAllCredentialSpecRequirements() []string { - return nil -} - // GetCredentialSpecResource retrieves credentialspec resource from resource map func (task *Task) GetCredentialSpecResource() ([]taskresource.TaskResource, bool) { return []taskresource.TaskResource{}, false diff --git a/agent/api/task/task_linux_test.go b/agent/api/task/task_linux_test.go index 331224e2f99..a8b9e73db81 100644 --- a/agent/api/task/task_linux_test.go +++ b/agent/api/task/task_linux_test.go @@ -61,6 +61,8 @@ const ( testTaskDefVersion = "1" testRegion = "testRegion" testExecutionCredentialsID = "testExecutionCredentialsID" + + defaultCPUPeriod = 100 * time.Millisecond // 100ms ) func TestAddNetworkResourceProvisioningDependencyNop(t *testing.T) { diff --git a/agent/api/task/task_test.go b/agent/api/task/task_test.go index 0183d0b3228..0ea7cc1f0f8 100644 --- a/agent/api/task/task_test.go +++ b/agent/api/task/task_test.go @@ -3434,5 +3434,14 @@ func TestRequiresEnvfiles(t *testing.T) { Containers: []*apicontainer.Container{container}, } - assert.Equal(t, true, task.requireEnvfiles()) + assert.Equal(t, true, requireEnvfiles(task)) +} + +func requireEnvfiles(task *Task) bool { + for _, container := range task.Containers { + if container.ShouldCreateWithEnvFiles() { + return true + } + } + return false } diff --git a/agent/api/task/task_unsupported.go b/agent/api/task/task_unsupported.go index 25c75543c15..81904459337 100644 --- a/agent/api/task/task_unsupported.go +++ b/agent/api/task/task_unsupported.go @@ -27,15 +27,7 @@ import ( ) const ( - defaultCPUPeriod = 100 * time.Millisecond // 100ms - - // With a 100ms CPU period, we can express 0.01 vCPU to 10 vCPUs - maxTaskVCPULimit = 10 - // Reference: http://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_ContainerDefinition.html - minimumCPUShare = 2 - minimumCPUPercent = 0 - bytesPerMegabyte = 1024 * 1024 ) // PlatformFields consists of fields specific to Linux for a task @@ -80,11 +72,6 @@ func (task *Task) initializeCredentialSpecResource(config *config.Config, creden return errors.New("task credentialspec is only supported on windows") } -// getAllCredentialSpecRequirements is used to build all the credential spec requirements for the task -func (task *Task) getAllCredentialSpecRequirements() []string { - return nil -} - // GetCredentialSpecResource retrieves credentialspec resource from resource map func (task *Task) GetCredentialSpecResource() ([]taskresource.TaskResource, bool) { return []taskresource.TaskResource{}, false diff --git a/agent/api/task/taskvolume.go b/agent/api/task/taskvolume.go index fcda021ec4d..05e696a88a8 100644 --- a/agent/api/task/taskvolume.go +++ b/agent/api/task/taskvolume.go @@ -29,8 +29,6 @@ const ( HostVolumeType = "host" DockerVolumeType = "docker" EFSVolumeType = "efs" - - efsVolumePluginCapability = "efsAuth" ) // TaskVolume is a definition of all the volumes available for containers to diff --git a/agent/app/agent_test.go b/agent/app/agent_test.go index f91b1efc321..397d2974f57 100644 --- a/agent/app/agent_test.go +++ b/agent/app/agent_test.go @@ -579,7 +579,7 @@ func TestNewTaskEngineRestoreFromCheckpointClusterIDMismatch(t *testing.T) { _, _, err := agent.newTaskEngine(eventstream.NewEventStream("events", ctx), credentialsManager, state, imageManager) assert.Error(t, err) - assert.True(t, isClusterMismatch(err)) + assert.IsType(t, clusterMismatchError{}, err) } func TestNewTaskEngineRestoreFromCheckpointNewStateManagerError(t *testing.T) { diff --git a/agent/app/errors.go b/agent/app/errors.go index fae7c28bc35..06b02349b84 100644 --- a/agent/app/errors.go +++ b/agent/app/errors.go @@ -29,8 +29,3 @@ func isTransient(err error) bool { type clusterMismatchError struct { error } - -func isClusterMismatch(err error) bool { - _, ok := err.(clusterMismatchError) - return ok -} diff --git a/agent/containermetadata/manager.go b/agent/containermetadata/manager.go index 67c7f83cec0..511b4df9e54 100644 --- a/agent/containermetadata/manager.go +++ b/agent/containermetadata/manager.go @@ -22,7 +22,6 @@ import ( apitask "github.com/aws/amazon-ecs-agent/agent/api/task" "github.com/aws/amazon-ecs-agent/agent/config" "github.com/aws/amazon-ecs-agent/agent/dockerclient" - "github.com/aws/amazon-ecs-agent/agent/utils/ioutilwrapper" dockercontainer "github.com/docker/docker/api/types/container" ) @@ -61,8 +60,6 @@ type metadataManager struct { dataDirOnHost string // containerInstanceARN is the Container Instance ARN registered for this agent containerInstanceARN string - // ioutilWrap is a wrapper for 'ioutil' package operations - ioutilWrap ioutilwrapper.IOUtil // availabilityZone is the availabiltyZone where task is in availabilityZone string // hostPrivateIPv4Address is the private IPv4 address associated with the EC2 instance diff --git a/agent/containermetadata/types.go b/agent/containermetadata/types.go index 177676bfe7e..e3276a52c10 100644 --- a/agent/containermetadata/types.go +++ b/agent/containermetadata/types.go @@ -105,7 +105,6 @@ type DockerContainerMetadata struct { dockerContainerName string imageID string imageName string - networkMode string ports []apicontainer.PortBinding networkInfo NetworkMetadata } diff --git a/agent/dockerclient/dockerapi/docker_client.go b/agent/dockerclient/dockerapi/docker_client.go index eba65880b45..9d66d3205db 100644 --- a/agent/dockerclient/dockerapi/docker_client.go +++ b/agent/dockerclient/dockerapi/docker_client.go @@ -54,10 +54,6 @@ import ( const ( dockerDefaultTag = "latest" - // imageNameFormat is the name of a image may look like: repo:tag - imageNameFormat = "%s:%s" - // the buffer size will ensure agent doesn't miss any event from docker - dockerEventBufferSize = 100 // healthCheckStarting is the initial status returned from docker container health check healthCheckStarting = "starting" // healthCheckHealthy is the healthy status returned from docker container health check @@ -243,9 +239,6 @@ func (dg *dockerGoClient) WithVersion(version dockerclient.DockerVersion) Docker } } -// scratchCreateLock guards against multiple 'scratch' image creations at once -var scratchCreateLock sync.Mutex - // NewDockerGoClient creates a new DockerGoClient // TODO Remove clientfactory parameter once migration to Docker SDK is complete. func NewDockerGoClient(sdkclientFactory sdkclientfactory.Factory, @@ -1035,15 +1028,13 @@ func (dg *dockerGoClient) listImages(ctx context.Context) ListImagesResponse { if err != nil { return ListImagesResponse{Error: err} } - var imagesRepoTag []string + var imageRepoTags []string imageIDs := make([]string, len(images)) for i, image := range images { imageIDs[i] = image.ID - for _, imageRepoTag := range image.RepoTags { - imagesRepoTag = append(imagesRepoTag, imageRepoTag) - } + imageRepoTags = append(imageRepoTags, image.RepoTags...) } - return ListImagesResponse{ImageIDs: imageIDs, RepoTags: imagesRepoTag, Error: nil} + return ListImagesResponse{ImageIDs: imageIDs, RepoTags: imageRepoTags, Error: nil} } func (dg *dockerGoClient) SupportedVersions() []dockerclient.DockerVersion { diff --git a/agent/dockerclient/dockerapi/docker_client_test.go b/agent/dockerclient/dockerapi/docker_client_test.go index 81aaf2fe132..685ea1f772c 100644 --- a/agent/dockerclient/dockerapi/docker_client_test.go +++ b/agent/dockerclient/dockerapi/docker_client_test.go @@ -74,6 +74,7 @@ const ( xMaximumPullRetryDelay = 100 * time.Microsecond xPullRetryDelayMultiplier = 2 xPullRetryJitterMultiplier = 0.2 + dockerEventBufferSize = 100 ) func defaultTestConfig() *config.Config { diff --git a/agent/dockerclient/dockerapi/docker_events_buffer.go b/agent/dockerclient/dockerapi/docker_events_buffer.go index 27669bdc9f0..8e9667427e0 100644 --- a/agent/dockerclient/dockerapi/docker_events_buffer.go +++ b/agent/dockerclient/dockerapi/docker_events_buffer.go @@ -42,7 +42,6 @@ type InfiniteBuffer struct { events []*events.Message empty bool waitForEvent sync.WaitGroup - count int lock sync.RWMutex } diff --git a/agent/dockerclient/sdkclientfactory/sdkclientfactory.go b/agent/dockerclient/sdkclientfactory/sdkclientfactory.go index e57dfade64e..dc9f099404a 100644 --- a/agent/dockerclient/sdkclientfactory/sdkclientfactory.go +++ b/agent/dockerclient/sdkclientfactory/sdkclientfactory.go @@ -23,15 +23,6 @@ import ( "github.com/pkg/errors" ) -const ( - // minAPIVersionKey is the docker.Env key for min API version - // This is supported in Docker API versions >=1.25 - // https://docs.docker.com/engine/api/version-history/#v125-api-changes - minAPIVersionKey = "MinAPIVersion" - // apiVersionKey is the docker.Env key for API version - apiVersionKey = "ApiVersion" -) - // Factory provides a collection of docker remote clients that include a // recommended client version as well as a set of alternative supported // docker clients. diff --git a/agent/ecscni/plugin.go b/agent/ecscni/plugin.go index 4a7534f47b2..19595318603 100644 --- a/agent/ecscni/plugin.go +++ b/agent/ecscni/plugin.go @@ -90,11 +90,6 @@ func (client *cniClient) SetupNS( timeout time.Duration) (*current.Result, error) { ctx, cancel := context.WithTimeout(ctx, timeout) defer cancel() - - type output struct { - result *current.Result - err error - } return client.setupNS(ctx, cfg) } diff --git a/agent/engine/dependencygraph/graph.go b/agent/engine/dependencygraph/graph.go index ad5611effcb..c0cc1f1218b 100644 --- a/agent/engine/dependencygraph/graph.go +++ b/agent/engine/dependencygraph/graph.go @@ -201,15 +201,6 @@ func verifyContainerDependenciesResolvedForResource(target taskresource.TaskReso return true } -func linksToContainerNames(links []string) []string { - names := make([]string, 0, len(links)) - for _, link := range links { - name := strings.Split(link, ":")[0] - names = append(names, name) - } - return names -} - func executionCredentialsResolved(target *apicontainer.Container, id string, manager credentials.Manager) bool { if target.GetKnownStatus() >= apicontainerstatus.ContainerPulled || !target.ShouldPullWithExecutionRole() || diff --git a/agent/engine/task_manager.go b/agent/engine/task_manager.go index 70cb93fb20d..72a9bc2cc26 100644 --- a/agent/engine/task_manager.go +++ b/agent/engine/task_manager.go @@ -41,7 +41,6 @@ import ( "github.com/aws/amazon-ecs-agent/agent/utils/ttime" "github.com/cihub/seelog" - "github.com/pkg/errors" ) const ( @@ -58,15 +57,10 @@ const ( ) var ( - _stoppedSentWaitInterval = stoppedSentWaitInterval - _maxStoppedWaitTimes = int(maxStoppedWaitTimes) - taskNotWaitForSteadyStateError = errors.New("managed task: steady state check context is nil") + _stoppedSentWaitInterval = stoppedSentWaitInterval + _maxStoppedWaitTimes = int(maxStoppedWaitTimes) ) -type acsTaskUpdate struct { - apitaskstatus.TaskStatus -} - type dockerContainerChange struct { container *apicontainer.Container event dockerapi.DockerContainerChangeEvent diff --git a/agent/eventhandler/task_handler.go b/agent/eventhandler/task_handler.go index 9a656ac6328..fc8ae171ccb 100644 --- a/agent/eventhandler/task_handler.go +++ b/agent/eventhandler/task_handler.go @@ -390,15 +390,6 @@ func (taskEvents *taskSendableEvents) toStringUnsafe() string { taskEvents.taskARN, taskEvents.sending, taskEvents.createdAt.String()) } -// getTasksToEventsLen returns the length of the tasksToEvents map. It is -// used only in the test code to ascertain that map has been cleaned up -func (handler *TaskHandler) getTasksToEventsLen() int { - handler.lock.RLock() - defer handler.lock.RUnlock() - - return len(handler.tasksToEvents) -} - // handleInvalidParamException removes the event from event queue when its parameters are // invalid to reduce redundant API call func handleInvalidParamException(err error, events *list.List, eventToSubmit *list.Element) { diff --git a/agent/eventhandler/task_handler_test.go b/agent/eventhandler/task_handler_test.go index 143c01f3112..2c3cdf96487 100644 --- a/agent/eventhandler/task_handler_test.go +++ b/agent/eventhandler/task_handler_test.go @@ -335,13 +335,22 @@ func TestCleanupTaskEventAfterSubmit(t *testing.T) { // Wait for task events to be removed from the tasksToEvents map for { - if handler.getTasksToEventsLen() == 0 { + if getTasksToEventsLen(handler) == 0 { break } time.Sleep(time.Millisecond) } } +// getTasksToEventsLen returns the length of the tasksToEvents map. It is +// used only in the test code to ascertain that map has been cleaned up +func getTasksToEventsLen(handler *TaskHandler) int { + handler.lock.RLock() + defer handler.lock.RUnlock() + + return len(handler.tasksToEvents) +} + func containerEvent(arn string) statechange.Event { return api.ContainerStateChange{TaskArn: arn, ContainerName: "containerName", Status: apicontainerstatus.ContainerRunning, Container: &apicontainer.Container{}} } diff --git a/agent/eventhandler/task_handler_types.go b/agent/eventhandler/task_handler_types.go index f47a5b08575..e99f9e19564 100644 --- a/agent/eventhandler/task_handler_types.go +++ b/agent/eventhandler/task_handler_types.go @@ -40,14 +40,6 @@ type sendableEvent struct { lock sync.RWMutex } -func newSendableContainerEvent(event api.ContainerStateChange) *sendableEvent { - return &sendableEvent{ - isContainerEvent: true, - containerSent: false, - containerChange: event, - } -} - func newSendableTaskEvent(event api.TaskStateChange) *sendableEvent { return &sendableEvent{ isContainerEvent: false, diff --git a/agent/eventhandler/task_handler_types_test.go b/agent/eventhandler/task_handler_types_test.go index b86ecea0d35..a298b91f6b5 100644 --- a/agent/eventhandler/task_handler_types_test.go +++ b/agent/eventhandler/task_handler_types_test.go @@ -29,6 +29,14 @@ import ( "github.com/stretchr/testify/assert" ) +func newSendableContainerEvent(event api.ContainerStateChange) *sendableEvent { + return &sendableEvent{ + isContainerEvent: true, + containerSent: false, + containerChange: event, + } +} + func TestShouldContainerEventBeSent(t *testing.T) { event := newSendableContainerEvent(api.ContainerStateChange{ Status: apicontainerstatus.ContainerStopped, diff --git a/agent/httpclient/httpclient.go b/agent/httpclient/httpclient.go index 76ab9aebcf2..0f69e363def 100644 --- a/agent/httpclient/httpclient.go +++ b/agent/httpclient/httpclient.go @@ -27,8 +27,6 @@ import ( "github.com/aws/amazon-ecs-agent/agent/version" ) -const defaultTimeout = 10 * time.Minute - // Taken from the default http.Client behavior const defaultDialTimeout = 30 * time.Second const defaultDialKeepalive = 30 * time.Second diff --git a/agent/metrics/generic_metrics_client.go b/agent/metrics/generic_metrics_client.go index 6a5e5c73adc..7aab5a633b8 100644 --- a/agent/metrics/generic_metrics_client.go +++ b/agent/metrics/generic_metrics_client.go @@ -115,12 +115,6 @@ func (gm *GenericMetrics) FireCallEnd(callHash, callName string, timestamp time. } } -// Simple Timeout function -func startTimeout(timeout chan bool) { - time.Sleep(callTimeout) - timeout <- true -} - // This function increments the call count for a specific API call // This is invoked at the API call's start, whereas the duration metrics // are updated at the API call's end. diff --git a/agent/metrics/metrics_engine.go b/agent/metrics/metrics_engine.go index 14f4ed72d64..fc29b404ba7 100644 --- a/agent/metrics/metrics_engine.go +++ b/agent/metrics/metrics_engine.go @@ -14,7 +14,6 @@ package metrics import ( - "context" "fmt" "net/http" "time" @@ -29,7 +28,6 @@ type APIType int32 type MetricsEngine struct { collection bool cfg *config.Config - ctx context.Context Registry *prometheus.Registry managedMetrics map[APIType]MetricsClient } diff --git a/agent/stats/common_test.go b/agent/stats/common_test.go index ba607de466f..1dabada3c64 100644 --- a/agent/stats/common_test.go +++ b/agent/stats/common_test.go @@ -68,6 +68,12 @@ func init() { cfg.ImagePullBehavior = config.ImagePullPreferCachedBehavior } +// parseNanoTime returns the time object from a string formatted with RFC3339Nano layout. +func parseNanoTime(value string) time.Time { + ts, _ := time.Parse(time.RFC3339Nano, value) + return ts +} + // eventStream returns the event stream used to receive container change events func eventStream(name string) *eventstream.EventStream { eventStream := eventstream.NewEventStream(name, context.Background()) diff --git a/agent/stats/engine.go b/agent/stats/engine.go index 00481923896..6f9fb951aba 100644 --- a/agent/stats/engine.go +++ b/agent/stats/engine.go @@ -205,13 +205,10 @@ func (engine *DockerStatsEngine) Disable() { // waitToStop waits for the container change event stream close ans stop collection metrics func (engine *DockerStatsEngine) waitToStop() { // Waiting for the event stream to close - ctx := engine.containerChangeEventStream.Context() - select { - case <-ctx.Done(): - seelog.Debug("Event stream closed, stop listening to the event stream") - engine.containerChangeEventStream.Unsubscribe(containerChangeHandler) - engine.removeAll() - } + <-engine.containerChangeEventStream.Context().Done() + seelog.Debug("Event stream closed, stop listening to the event stream") + engine.containerChangeEventStream.Unsubscribe(containerChangeHandler) + engine.removeAll() } // removeAll stops the periodic usage data collection for all containers @@ -686,11 +683,3 @@ func (engine *DockerStatsEngine) ContainerDockerStats(taskARN string, containerI } return container.statsQueue.GetLastStat(), nil } - -// newMetricsMetadata creates the singleton metadata object. -func newMetricsMetadata(cluster *string, containerInstance *string) *ecstcs.MetricsMetadata { - return &ecstcs.MetricsMetadata{ - Cluster: cluster, - ContainerInstance: containerInstance, - } -} diff --git a/agent/stats/utils.go b/agent/stats/utils.go index 38dd4396f98..9e6ec4720cc 100644 --- a/agent/stats/utils.go +++ b/agent/stats/utils.go @@ -15,18 +15,11 @@ package stats import ( "math" - "regexp" "runtime" - "time" - "github.com/cihub/seelog" "github.com/docker/docker/api/types" ) -// networkStatsErrorPattern defines the pattern that is used to evaluate -// if there's an error reading network stats. -const networkStatsErrorPattern = "open /sys/class/net/veth.*: no such file or directory" - var numCores = uint64(runtime.NumCPU()) // nan32 returns a 32bit NaN. @@ -34,24 +27,6 @@ func nan32() float32 { return (float32)(math.NaN()) } -// parseNanoTime returns the time object from a string formatted with RFC3339Nano layout. -func parseNanoTime(value string) time.Time { - ts, _ := time.Parse(time.RFC3339Nano, value) - return ts -} - -// isNetworkStatsError returns if the error indicates that files in /sys/class/net -// could not be opened. -func isNetworkStatsError(err error) bool { - matched, mErr := regexp.MatchString(networkStatsErrorPattern, err.Error()) - if mErr != nil { - seelog.Debugf("Error matching string: %v", mErr) - return false - } - - return matched -} - func getNetworkStats(dockerStats *types.StatsJSON) *NetworkStats { if dockerStats.Networks == nil { return nil diff --git a/agent/stats/utils_test.go b/agent/stats/utils_test.go index b5ae1f57049..75de6dc16ae 100644 --- a/agent/stats/utils_test.go +++ b/agent/stats/utils_test.go @@ -36,20 +36,6 @@ const ( expectedTxErrors = uint64(0) ) -func TestIsNetworkStatsError(t *testing.T) { - isNetStatsErr := isNetworkStatsError(fmt.Errorf("no such file or directory")) - if isNetStatsErr { - // Expect it to not be a net stats error - t.Error("Error incorrectly reported as network stats error") - } - - isNetStatsErr = isNetworkStatsError(fmt.Errorf("open /sys/class/net/veth2f5f3e4/statistics/tx_bytes: no such file or directory")) - if !isNetStatsErr { - // Expect this to be a net stats error - t.Error("Error incorrectly reported as non network stats error") - } -} - func TestDockerStatsToContainerStatsMemUsage(t *testing.T) { jsonStat := fmt.Sprintf(` { diff --git a/agent/taskresource/credentialspec/credentialspec_unsupported.go b/agent/taskresource/credentialspec/credentialspec_unsupported.go index a7ab7b42774..70d1757ec2b 100644 --- a/agent/taskresource/credentialspec/credentialspec_unsupported.go +++ b/agent/taskresource/credentialspec/credentialspec_unsupported.go @@ -98,10 +98,6 @@ func (cs *CredentialSpecResource) SteadyState() resourcestatus.ResourceStatus { func (cs *CredentialSpecResource) SetKnownStatus(status resourcestatus.ResourceStatus) { } -// updateAppliedStatusUnsafe updates the resource transitioning status -func (cs *CredentialSpecResource) updateAppliedStatusUnsafe(knownStatus resourcestatus.ResourceStatus) { -} - // SetAppliedStatus sets the applied status of resource and returns whether // the resource is already in a transition func (cs *CredentialSpecResource) SetAppliedStatus(status resourcestatus.ResourceStatus) bool { diff --git a/agent/taskresource/credentialspec/credentialspec_windows.go b/agent/taskresource/credentialspec/credentialspec_windows.go index 273d4d7577f..34511d8c8ac 100644 --- a/agent/taskresource/credentialspec/credentialspec_windows.go +++ b/agent/taskresource/credentialspec/credentialspec_windows.go @@ -41,6 +41,18 @@ import ( "github.com/pkg/errors" ) +const ( + tempFileName = "temp_file" + // filePerm is the permission for the credentialspec file. + filePerm = 0644 + + s3DownloadTimeout = 30 * time.Second + + // Environment variables to setup resource location + envProgramData = "ProgramData" + dockerCredentialSpecDataDir = "docker/credentialspecs" +) + // CredentialSpecResource is the abstraction for credentialspec resources type CredentialSpecResource struct { taskARN string diff --git a/agent/taskresource/credentialspec/types.go b/agent/taskresource/credentialspec/types.go index ebb77938d80..14fbde728ba 100644 --- a/agent/taskresource/credentialspec/types.go +++ b/agent/taskresource/credentialspec/types.go @@ -13,20 +13,7 @@ package credentialspec -import "time" - const ( // ResourceName is the name of the credentialspec resource ResourceName = "credentialspec" - - tempFileName = "temp_file" - - // filePerm is the permission for the credentialspec file. - filePerm = 0644 - - s3DownloadTimeout = 30 * time.Second - - // Environment variables to setup resource location - envProgramData = "ProgramData" - dockerCredentialSpecDataDir = "docker/credentialspecs" )