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 cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ var (
PrintParameters string

ClientConfig client.ClientConfig
Variables = map[string]interface{}{}
Variables = map[string]any{}
Headers = map[string]string{
"User-Agent": fmt.Sprintf("lac/%s", version),
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (

func runCommandFunction(
args []string,
variables map[string]interface{},
variables map[string]any,
headers map[string]string,
clientConfig *client.ClientConfig,
) {
Expand Down Expand Up @@ -43,7 +43,7 @@ func runCommandFunction(

func runRequest(
req *request.Request,
variables map[string]interface{},
variables map[string]any,
headers map[string]string,
client *client.Client,
auth authentication.Auth,
Expand Down
2 changes: 1 addition & 1 deletion pkg/param/param.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

type Param string

func (p Param) Resolve(replacements map[string]interface{}, useEnv bool) string {
func (p Param) Resolve(replacements map[string]any, useEnv bool) string {
resolve := func(placeholder string, quoted bool) string {
if replacements != nil {
if value, ok := replacements[placeholder]; ok {
Expand Down
10 changes: 5 additions & 5 deletions pkg/param/param_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func TestResolveWithoutEnv(t *testing.T) {

func TestReplaceMultipleWithReplacements(t *testing.T) {
param := Param("${replacement_1}, ${replacement_2}!")
replacements := map[string]interface{}{
replacements := map[string]any{
"replacement_1": "Hello",
"replacement_2": "World",
}
Expand All @@ -68,7 +68,7 @@ func TestReplaceMultipleWithReplacements(t *testing.T) {
func TestReplaceWithNumericValues(t *testing.T) {
param := Param("The answer is ${number} and I have ${float_num} dollars")

replacements := map[string]interface{}{
replacements := map[string]any{
"number": 42,
"float_num": 10.5,
}
Expand All @@ -81,7 +81,7 @@ func TestReplaceWithNumericValues(t *testing.T) {

func TestReplaceWithBooleanValues(t *testing.T) {
param := Param("The statement is ${bool_value}")
replacements := map[string]interface{}{
replacements := map[string]any{
"bool_value": true,
}
expected := "The statement is true"
Expand All @@ -92,7 +92,7 @@ func TestReplaceWithBooleanValues(t *testing.T) {

func TestReplaceWithNullValues(t *testing.T) {
param := Param("Is it ${null_value}")
replacements := map[string]interface{}{
replacements := map[string]any{
"null_value": nil,
}
expected := "Is it null"
Expand All @@ -103,7 +103,7 @@ func TestReplaceWithNullValues(t *testing.T) {

func TestReplaceWithQuotedString(t *testing.T) {
param := Param(`"${value}"`)
replacements := map[string]interface{}{
replacements := map[string]any{
"value": "Hello, World",
}
expected := `"Hello, World"`
Expand Down
4 changes: 2 additions & 2 deletions pkg/request/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func (b *ByteBody) UnmarshalJSON(data []byte) error {
}

func (b *ByteBody) UnmarshalYAML(value *yaml.Node) error {
var raw interface{}
var raw any
if err := value.Decode(&raw); err != nil {
return err
}
Expand Down Expand Up @@ -67,7 +67,7 @@ func (s *StringOrStringList) UnmarshalJSON(data []byte) error {
}

func (s *StringOrStringList) UnmarshalYAML(value *yaml.Node) error {
var raw interface{}
var raw any
if err := value.Decode(&raw); err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/request/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func NewTemplate(templatePath string) (*Template, error) {
return &result, nil
}

func (t *Template) Interpolate(vars map[string]interface{}, useEnv bool) *Template {
func (t *Template) Interpolate(vars map[string]any, useEnv bool) *Template {
result := Template(param.Param(*t).Resolve(vars, true))
return &result
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/request/template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func TestTemplate_Interpolate(t *testing.T) {
},
}

vars := map[string]interface{}{
vars := map[string]any{
"string": "hello, world",
"number": 7,
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/utils/file_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"gopkg.in/yaml.v3"
)

func LoadItem(item string, dst interface{}) error {
func LoadItem(item string, dst any) error {
var (
err error
data *[]byte
Expand Down
8 changes: 3 additions & 5 deletions pkg/utils/map_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"maps"
)

func FlattenMap(input map[string]interface{}, prefix string) map[string]string {
func FlattenMap(input map[string]any, prefix string) map[string]string {
flattened := map[string]string{}

for key, value := range input {
Expand All @@ -17,11 +17,9 @@ func FlattenMap(input map[string]interface{}, prefix string) map[string]string {
}

switch child := value.(type) {
case map[string]interface{}:
case map[string]any:
submap := FlattenMap(child, newKey)
for k, v := range submap {
flattened[k] = v
}
maps.Copy(flattened, submap)
default:
flattened[newKey] = fmt.Sprintf("%v", value)
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/utils/map_utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import (
)

func TestFlattenMap(t *testing.T) {
m := map[string]interface{}{
"a": map[string]interface{}{
m := map[string]any{
"a": map[string]any{
"b": "c",
"d": map[string]interface{}{
"d": map[string]any{
"e": "f",
},
},
Expand Down