diff --git a/src/global/init.go b/src/global/init.go index a4f79b9..76f9d6a 100644 --- a/src/global/init.go +++ b/src/global/init.go @@ -9,11 +9,9 @@ import ( // Global variables that are useful in all packages. var ( - Arch string - Executable string - Library string - OS string - Root string + Arch string + Library string + OS string ) // init is the very first thing that's executed. @@ -23,21 +21,20 @@ func init() { OS = runtime.GOOS Arch = runtime.GOARCH - var err error - Executable, err = os.Executable() + executable, err := os.Executable() if err != nil { panic(err) } - Executable, err = filepath.EvalSymlinks(Executable) + executable, err = filepath.EvalSymlinks(executable) if err != nil { panic(err) } - Root = filepath.Dir(Executable) - Library = filepath.Join(Root, "lib") + root := filepath.Dir(executable) + Library = filepath.Join(root, "lib") stat, err := os.Stat(Library) if err != nil || !stat.IsDir() { diff --git a/src/global/init_test.go b/src/global/init_test.go index 78dbaf4..5092f54 100644 --- a/src/global/init_test.go +++ b/src/global/init_test.go @@ -10,8 +10,6 @@ import ( func TestInit(t *testing.T) { assert.Equal(t, global.Arch, runtime.GOARCH) - assert.True(t, len(global.Executable) > 0) assert.True(t, len(global.Library) > 0) assert.Equal(t, global.OS, runtime.GOOS) - assert.True(t, len(global.Root) > 0) } \ No newline at end of file