Skip to content

Commit 4a48f04

Browse files
refactor: Remove linux build tag, scope OSFamilyEnvVar to private var, remove unused constant
1 parent 5d473bf commit 4a48f04

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

agent/config/parse_linux.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import (
2828
)
2929

3030
const (
31-
OSFamilyEnvVar = "ECS_DETAILED_OS_FAMILY"
31+
osFamilyEnvVar = "ECS_DETAILED_OS_FAMILY"
3232
)
3333

3434
func parseGMSACapability() BooleanDefaultFalse {
@@ -119,7 +119,7 @@ func GetOSFamily() string {
119119
// GetDetailedOSFamily returns the operating system family for linux based ecs instances.
120120
// it first checks the ECS_DETAILED_OS_FAMILY environment variable set by ecs-init, and falls back to "LINUX" if not set
121121
func GetDetailedOSFamily() string {
122-
detailedOSFamily, ok := os.LookupEnv(OSFamilyEnvVar)
122+
detailedOSFamily, ok := os.LookupEnv(osFamilyEnvVar)
123123
if !ok {
124124
return strings.ToUpper(OSType)
125125
}

agent/config/parse_linux_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,14 @@ func TestParseTaskPidsLimit_Unset(t *testing.T) {
111111
}
112112

113113
func TestGetDetailedOSFamilyWithValidValue(t *testing.T) {
114-
t.Setenv(OSFamilyEnvVar, "debian_11")
114+
t.Setenv(osFamilyEnvVar, "debian_11")
115115

116116
result := GetDetailedOSFamily()
117117
assert.Equal(t, "debian_11", result)
118118
}
119119

120120
func TestGetDetailedOSFamilyWithEmptyValue(t *testing.T) {
121-
t.Setenv(OSFamilyEnvVar, "")
121+
t.Setenv(osFamilyEnvVar, "")
122122

123123
result := GetDetailedOSFamily()
124124
assert.Equal(t, "", result)
@@ -135,7 +135,7 @@ func TestGetOSFamilyAlwaysReturnsLinux(t *testing.T) {
135135
osFamily := GetOSFamily()
136136
assert.Equal(t, "LINUX", osFamily)
137137

138-
t.Setenv(OSFamilyEnvVar, "debian_11")
138+
t.Setenv(osFamilyEnvVar, "debian_11")
139139
osFamily = GetOSFamily()
140140
assert.Equal(t, "LINUX", osFamily)
141141
}

0 commit comments

Comments
 (0)