chore: refactor code (#1700)
This commit is contained in:
@@ -28,7 +28,7 @@ func New() *SortedMap {
|
||||
}
|
||||
}
|
||||
|
||||
func (m *SortedMap) SetExpression(expression string) (key interface{}, value interface{}, err error) {
|
||||
func (m *SortedMap) SetExpression(expression string) (key, value interface{}, err error) {
|
||||
idx := strings.Index(expression, "=")
|
||||
if idx == -1 {
|
||||
return "", "", ErrInvalidKVExpression
|
||||
@@ -86,7 +86,7 @@ func (m *SortedMap) Get(key interface{}) (interface{}, bool) {
|
||||
return e.Value.(KV)[1], true
|
||||
}
|
||||
|
||||
func (m *SortedMap) GetOr(key interface{}, dft interface{}) interface{} {
|
||||
func (m *SortedMap) GetOr(key, dft interface{}) interface{} {
|
||||
e, ok := m.keys[key]
|
||||
if !ok {
|
||||
return dft
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"os"
|
||||
)
|
||||
|
||||
func Download(url string, filename string) error {
|
||||
func Download(url, filename string) error {
|
||||
resp, err := http.Get(url)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
2
tools/goctl/pkg/env/env.go
vendored
2
tools/goctl/pkg/env/env.go
vendored
@@ -88,7 +88,7 @@ func Get(key string) string {
|
||||
return GetOr(key, "")
|
||||
}
|
||||
|
||||
func GetOr(key string, def string) string {
|
||||
func GetOr(key, def string) string {
|
||||
return goctlEnv.GetStringOr(key, def)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user