Skip to content

Commit

Permalink
Merge pull request #1414 from mesg-foundation/refactor/xos
Browse files Browse the repository at this point in the history
Remove not used functions from xos package
  • Loading branch information
antho1404 authored Oct 23, 2019
2 parents 8fdb6cd + 2c38806 commit 3677213
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 334 deletions.
10 changes: 0 additions & 10 deletions x/xos/env.go
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
package xos

import (
"os"
"sort"
"strings"
)

// GetenvDefault retrieves the value of the environment variable named by the key.
// It returns the value, which will be set to fallback if the variable is empty.
func GetenvDefault(key, fallback string) string {
if val := os.Getenv(key); val != "" {
return val
}
return fallback
}

// EnvMapToSlice transform a map of key value to a slice of env in the form "key=value".
// Env vars are sorted by names to get an accurate order while testing.
func EnvMapToSlice(values map[string]string) []string {
Expand Down
17 changes: 0 additions & 17 deletions x/xos/env_test.go
Original file line number Diff line number Diff line change
@@ -1,28 +1,11 @@
package xos

import (
"os"
"testing"

"github.com/mesg-foundation/engine/x/xstrings"
)

func TestGetenvDefault(t *testing.T) {
os.Setenv("__TEST_KEY__", "1")
for _, tt := range []struct {
key string
fallback string
expected string
}{
{"__TEST_KEY__", "0", "1"},
{"__TEST_KE1Y__", "0", "0"},
} {
if got := GetenvDefault(tt.key, tt.fallback); got != tt.expected {
t.Errorf("GetenvDefault(%q, %q) got %s, want %s", tt.key, tt.fallback, got, tt.expected)
}
}
}

func TestEnvMapToSlice(t *testing.T) {
env := EnvMapToSlice(map[string]string{
"a": "1",
Expand Down
25 changes: 0 additions & 25 deletions x/xos/file.go

This file was deleted.

116 changes: 0 additions & 116 deletions x/xos/os.go

This file was deleted.

166 changes: 0 additions & 166 deletions x/xos/os_test.go

This file was deleted.

0 comments on commit 3677213

Please sign in to comment.