golang-plugin/tool/go_tool_state.go

31 lines
616 B
Go

package tool
import (
"maps"
"slices"
)
type GoToolState struct {
Env map[string]string `json:"env,omitempty"`
InstalledVersion string `json:"installed_version"`
BuildArgs []string `json:"build_args,omitempty"`
}
func (s GoToolState) Equals(other GoToolState) bool {
if s.InstalledVersion != other.InstalledVersion {
return false
}
if len(s.BuildArgs) != len(other.BuildArgs) {
return false
}
slices.Sort(s.BuildArgs)
slices.Sort(other.BuildArgs)
if !slices.Equal(s.BuildArgs, other.BuildArgs) {
return false
}
return maps.Equal(s.Env, other.Env)
}