Skip to content
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
2 changes: 1 addition & 1 deletion pkg/minikube/extract/extract.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func newExtractor(functionsToCheck []string) (*state, error) {
// Functions must be of the form "package.function"
t2 := strings.Split(t, ".")
if len(t2) < 2 {
return nil, errors.Wrap(nil, fmt.Sprintf("Invalid function string %s. Needs package name as well.", t))
return nil, errors.Errorf("invalid function string %s. Needs package name as well", t)
}
f := funcType{
pack: t2[0],
Expand Down
10 changes: 10 additions & 0 deletions pkg/minikube/extract/extract_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package extract

import (
"encoding/json"
"errors"
"io/ioutil"
"os"
"path/filepath"
Expand Down Expand Up @@ -84,3 +85,12 @@ func TestExtract(t *testing.T) {
}

}

func TestExtractShouldReturnErrorOnFunctionWithoutPackage(t *testing.T) {
expected := errors.New("Initializing: invalid function string missing_package. Needs package name as well")
funcs := []string{"missing_package"}
err := TranslatableStrings([]string{}, funcs, "")
if err == nil || err.Error() != expected.Error() {
t.Fatalf("expected %v, got %v", expected, err)
}
}