NO-ISSUE: Remove code smells
	
		
			
	
		
	
	
		
			
				
	
				continuous-integration/drone/push Build is passing
				
					Details
				
			
		
	
				
					
				
			
				
	
				continuous-integration/drone/push Build is passing
				
					Details
				
			
		
	This commit is contained in:
		
							parent
							
								
									ec9c29f52b
								
							
						
					
					
						commit
						60add201c8
					
				
							
								
								
									
										13
									
								
								go.mod
								
								
								
								
							
							
						
						
									
										13
									
								
								go.mod
								
								
								
								
							|  | @ -1,8 +1,15 @@ | |||
| module scm.yoorie.de/go-lib/util | ||||
| 
 | ||||
| go 1.16 | ||||
| go 1.24.0 | ||||
| 
 | ||||
| require ( | ||||
| 	github.com/stretchr/testify v1.8.2 | ||||
| 	golang.org/x/sys v0.6.0 | ||||
| 	github.com/stretchr/testify v1.11.1 | ||||
| 	golang.org/x/sys v0.36.0 | ||||
| ) | ||||
| 
 | ||||
| require ( | ||||
| 	github.com/davecgh/go-spew v1.1.1 // indirect | ||||
| 	github.com/pmezard/go-difflib v1.0.0 // indirect | ||||
| 	gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect | ||||
| 	gopkg.in/yaml.v3 v3.0.1 // indirect | ||||
| ) | ||||
|  |  | |||
							
								
								
									
										23
									
								
								go.sum
								
								
								
								
							
							
						
						
									
										23
									
								
								go.sum
								
								
								
								
							|  | @ -1,19 +1,18 @@ | |||
| github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | ||||
| github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= | ||||
| github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | ||||
| github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= | ||||
| github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= | ||||
| github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= | ||||
| github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= | ||||
| github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= | ||||
| github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= | ||||
| github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= | ||||
| github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= | ||||
| github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= | ||||
| github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= | ||||
| github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= | ||||
| github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= | ||||
| github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= | ||||
| github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= | ||||
| golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= | ||||
| golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= | ||||
| gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= | ||||
| github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= | ||||
| github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= | ||||
| golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k= | ||||
| golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= | ||||
| gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | ||||
| gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= | ||||
| gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= | ||||
| gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= | ||||
| gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= | ||||
| gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= | ||||
|  |  | |||
|  | @ -12,7 +12,7 @@ import ( | |||
| // A.K.A root, Administrator etc
 | ||||
| func IsSuperUser() bool { | ||||
| 	cuser, err := user.Current() | ||||
| 	return err == nil && "0" == cuser.Uid | ||||
| 	return err == nil && cuser.Uid == "0" | ||||
| } | ||||
| 
 | ||||
| // GetGlobalConfigurationDirectory returns OS specific location for putting
 | ||||
|  |  | |||
|  | @ -1,7 +1,6 @@ | |||
| package util | ||||
| 
 | ||||
| import ( | ||||
| 	"fmt" | ||||
| 	"os" | ||||
| 	"os/user" | ||||
| 	"path/filepath" | ||||
|  | @ -67,7 +66,7 @@ func TestIsSuperUser(t *testing.T) { | |||
| 
 | ||||
| func TestGlobalConfigurationDirectoryWindows(t *testing.T) { | ||||
| 	if runtime.GOOS != "windows" { | ||||
| 		t.Skip(fmt.Sprintf("Skipping on OS %s", runtime.GOOS)) | ||||
| 		t.Skipf("Skipping on OS %s", runtime.GOOS) | ||||
| 	} | ||||
| 	appFolder := GetGlobalConfigurationDirectory("myapp") | ||||
| 	assert.Equal(t, filepath.Join(os.Getenv("APPDATA"), "myapp"), appFolder) | ||||
|  | @ -75,7 +74,7 @@ func TestGlobalConfigurationDirectoryWindows(t *testing.T) { | |||
| 
 | ||||
| func TestGlobalConfigurationDirectoryLinux(t *testing.T) { | ||||
| 	if runtime.GOOS != "linux" { | ||||
| 		t.Skip(fmt.Sprintf("Skipping on OS %s", runtime.GOOS)) | ||||
| 		t.Skipf("Skipping on OS %s", runtime.GOOS) | ||||
| 	} | ||||
| 	appFolder := GetGlobalConfigurationDirectory("myapp") | ||||
| 	assert.Equal(t, "/etc/myapp", appFolder) | ||||
|  | @ -83,7 +82,7 @@ func TestGlobalConfigurationDirectoryLinux(t *testing.T) { | |||
| 
 | ||||
| func TestGlobalConfigurationDirectoryMacOS(t *testing.T) { | ||||
| 	if runtime.GOOS != "darwin" { | ||||
| 		t.Skip(fmt.Sprintf("Skipping on OS %s", runtime.GOOS)) | ||||
| 		t.Skipf("Skipping on OS %s", runtime.GOOS) | ||||
| 	} | ||||
| 	appFolder := GetGlobalConfigurationDirectory("myapp") | ||||
| 	assert.Equal(t, "/etc/myapp", appFolder) | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue