diff --git a/src/k8s/pkg/docgen/godoc.go b/src/k8s/pkg/docgen/godoc.go index 817932493..3b414ea8d 100755 --- a/src/k8s/pkg/docgen/godoc.go +++ b/src/k8s/pkg/docgen/godoc.go @@ -103,12 +103,12 @@ func getFieldDocstring(i any, field reflect.StructField, projectDir string) (str structType := getStructTypeFromDoc(packageDoc, inType.Name()) if structType == nil { - return "", fmt.Errorf("could not find %s structure definition", inType.Name) + return "", fmt.Errorf("could not find %s structure definition", inType.Name()) } astField := getAstStructField(structType, field.Name) if astField == nil { - return "", fmt.Errorf("could not find %s.%s field definition", inType.Name, field.Name) + return "", fmt.Errorf("could not find %s.%s field definition", inType.Name(), field.Name) } return astField.Doc.Text(), nil diff --git a/src/k8s/pkg/docgen/gomod.go b/src/k8s/pkg/docgen/gomod.go index 807997d67..a7f446f6d 100755 --- a/src/k8s/pkg/docgen/gomod.go +++ b/src/k8s/pkg/docgen/gomod.go @@ -36,7 +36,7 @@ func getGoDepModulePath(name string, version string) (string, error) { // Validate the path. if _, err := os.Stat(path); err != nil { return "", fmt.Errorf( - "Go module path not accessible: %s %s %s. Error: %v.", + "Go module path not accessible: %s %s %s, error: %v.", name, version, path, err) } @@ -46,11 +46,11 @@ func getGoDepModulePath(name string, version string) (string, error) { func getDependencyVersionFromGoMod(goModPath string, packageName string, directOnly bool) (string, string, error) { goModContents, err := os.ReadFile(goModPath) if err != nil { - return "", "", fmt.Errorf("could not read go.mod file %s. Error: ", goModPath, err) + return "", "", fmt.Errorf("could not read go.mod file %s, error: %v", goModPath, err) } goModFile, err := modfile.ParseLax(goModPath, goModContents, nil) if err != nil { - return "", "", fmt.Errorf("could not parse go.mod file %s. Error: ", goModPath, err) + return "", "", fmt.Errorf("could not parse go.mod file %s, error: %v", goModPath, err) } for _, dep := range goModFile.Require { diff --git a/src/k8s/pkg/docgen/json_struct.go b/src/k8s/pkg/docgen/json_struct.go index ad44ede3c..d6463131e 100755 --- a/src/k8s/pkg/docgen/json_struct.go +++ b/src/k8s/pkg/docgen/json_struct.go @@ -88,7 +88,7 @@ func ParseStruct(i any, projectDir string) ([]Field, error) { inType := reflect.TypeOf(i) if inType.Kind() != reflect.Struct { - return nil, fmt.Errorf("structure parsing failed, not a structure: %s", inType.Name) + return nil, fmt.Errorf("structure parsing failed, not a structure: %s", inType.Name()) } outFields := []Field{} @@ -98,7 +98,7 @@ func ParseStruct(i any, projectDir string) ([]Field, error) { docstring, err := getFieldDocstring(i, field, projectDir) if err != nil { fmt.Fprintf(os.Stderr, "WARNING: could not retrieve field docstring: %s.%s, error: %v", - inType.Name, field.Name, err) + inType.Name(), field.Name, err) } if field.Type.Kind() == reflect.Struct {