Skip to content

Commit

Permalink
remove locator validator
Browse files Browse the repository at this point in the history
  • Loading branch information
h4ck3rk3y committed Oct 9, 2023
1 parent e29eae5 commit d4f3b88
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func NewImportModule(
IsOptional: false,
ZeroValueProvider: builtin_argument.ZeroValueProvider[starlark.String],
Validator: func(value starlark.Value) *startosis_errors.InterpretationError {
return builtin_argument.LocatorValidator(value, packageId, ModuleFileArgName)
return builtin_argument.NonEmptyString(value, ModuleFileArgName)
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func NewReadFileHelper(
IsOptional: false,
ZeroValueProvider: builtin_argument.ZeroValueProvider[starlark.String],
Validator: func(value starlark.Value) *startosis_errors.InterpretationError {
return builtin_argument.LocatorValidator(value, packageId, SrcArgName)
return builtin_argument.NonEmptyString(value, SrcArgName)
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func NewUploadFiles(
IsOptional: false,
ZeroValueProvider: builtin_argument.ZeroValueProvider[starlark.String],
Validator: func(value starlark.Value) *startosis_errors.InterpretationError {
return builtin_argument.LocatorValidator(value, packageId, SrcArgName)
return builtin_argument.NonEmptyString(value, SrcArgName)
},
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,3 @@ func DurationOrNone(value starlark.Value, attributeName string) *startosis_error
}
return nil
}

func LocatorValidator(locatorStarlarkValue starlark.Value, packageId string, argNameForLogging string) *startosis_errors.InterpretationError {

if err := NonEmptyString(locatorStarlarkValue, argNameForLogging); err != nil {
return err
}

_, ok := locatorStarlarkValue.(starlark.String)
if !ok {
return startosis_errors.NewInterpretationError("Value for '%s' was expected to be a starlark.String but was '%s'", argNameForLogging, reflect.TypeOf(locatorStarlarkValue))
}
return nil
}

0 comments on commit d4f3b88

Please sign in to comment.