Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove not used functions from xos package #1414

Merged
merged 1 commit into from
Oct 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.