mirror of
https://github.com/F1bonacc1/process-compose.git
synced 2024-09-11 11:35:26 +03:00
remove errors pkg
This commit is contained in:
parent
6359011960
commit
9d37b8f25d
1
go.mod
1
go.mod
@ -11,7 +11,6 @@ require (
|
|||||||
github.com/gin-gonic/gin v1.8.1
|
github.com/gin-gonic/gin v1.8.1
|
||||||
github.com/imdario/mergo v0.3.13
|
github.com/imdario/mergo v0.3.13
|
||||||
github.com/joho/godotenv v1.4.0
|
github.com/joho/godotenv v1.4.0
|
||||||
github.com/pkg/errors v0.9.1
|
|
||||||
github.com/rivo/tview v0.0.0-20221128165837-db36428c92d9
|
github.com/rivo/tview v0.0.0-20221128165837-db36428c92d9
|
||||||
github.com/spf13/cobra v1.6.1
|
github.com/spf13/cobra v1.6.1
|
||||||
github.com/swaggo/swag v1.8.8
|
github.com/swaggo/swag v1.8.8
|
||||||
|
1
go.sum
1
go.sum
@ -144,7 +144,6 @@ github.com/pelletier/go-toml/v2 v2.0.1/go.mod h1:r9LEWfGN8R5k0VXJ+0BkIe7MYkRdwZO
|
|||||||
github.com/pelletier/go-toml/v2 v2.0.6 h1:nrzqCb7j9cDFj2coyLNLaZuJTLjWjlaz6nvTvIwycIU=
|
github.com/pelletier/go-toml/v2 v2.0.6 h1:nrzqCb7j9cDFj2coyLNLaZuJTLjWjlaz6nvTvIwycIU=
|
||||||
github.com/pelletier/go-toml/v2 v2.0.6/go.mod h1:eumQOmlWiOPt5WriQQqoM5y18pDHwha2N+QD+EUNTek=
|
github.com/pelletier/go-toml/v2 v2.0.6/go.mod h1:eumQOmlWiOPt5WriQQqoM5y18pDHwha2N+QD+EUNTek=
|
||||||
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
|
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
|
||||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
|
||||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
|
@ -4,7 +4,6 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"github.com/f1bonacc1/process-compose/src/types"
|
"github.com/f1bonacc1/process-compose/src/types"
|
||||||
"github.com/imdario/mergo"
|
"github.com/imdario/mergo"
|
||||||
"github.com/pkg/errors"
|
|
||||||
"reflect"
|
"reflect"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
@ -57,7 +56,7 @@ func mergeSlice(toMap toMapFn, writeValue writeValueFromMapFn) func(dst, src ref
|
|||||||
func sliceToMap(toMap toMapFn, v reflect.Value) (map[interface{}]interface{}, error) {
|
func sliceToMap(toMap toMapFn, v reflect.Value) (map[interface{}]interface{}, error) {
|
||||||
// check if valid
|
// check if valid
|
||||||
if !v.IsValid() {
|
if !v.IsValid() {
|
||||||
return nil, errors.Errorf("invalid value : %+v", v)
|
return nil, fmt.Errorf("invalid value : %+v", v)
|
||||||
}
|
}
|
||||||
return toMap(v.Interface())
|
return toMap(v.Interface())
|
||||||
}
|
}
|
||||||
@ -65,7 +64,7 @@ func sliceToMap(toMap toMapFn, v reflect.Value) (map[interface{}]interface{}, er
|
|||||||
func toEnvVarMap(s interface{}) (map[interface{}]interface{}, error) {
|
func toEnvVarMap(s interface{}) (map[interface{}]interface{}, error) {
|
||||||
envVars, ok := s.(types.Environment)
|
envVars, ok := s.(types.Environment)
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, errors.Errorf("not an Environment slice: %v", s)
|
return nil, fmt.Errorf("not an Environment slice: %v", s)
|
||||||
}
|
}
|
||||||
m := map[interface{}]interface{}{}
|
m := map[interface{}]interface{}{}
|
||||||
for _, v := range envVars {
|
for _, v := range envVars {
|
||||||
@ -104,10 +103,10 @@ func merge(opts *LoaderOptions) (*types.Project, error) {
|
|||||||
}
|
}
|
||||||
func specialProcessesMerge(dst, src reflect.Value) error {
|
func specialProcessesMerge(dst, src reflect.Value) error {
|
||||||
if !dst.IsValid() {
|
if !dst.IsValid() {
|
||||||
return errors.Errorf("invalid value: %+v", dst)
|
return fmt.Errorf("invalid value: %+v", dst)
|
||||||
}
|
}
|
||||||
if !src.IsValid() {
|
if !src.IsValid() {
|
||||||
return errors.Errorf("invalid value: %+v", src)
|
return fmt.Errorf("invalid value: %+v", src)
|
||||||
}
|
}
|
||||||
var (
|
var (
|
||||||
dstProc types.Processes
|
dstProc types.Processes
|
||||||
@ -115,10 +114,10 @@ func specialProcessesMerge(dst, src reflect.Value) error {
|
|||||||
ok bool
|
ok bool
|
||||||
)
|
)
|
||||||
if dstProc, ok = dst.Interface().(types.Processes); !ok {
|
if dstProc, ok = dst.Interface().(types.Processes); !ok {
|
||||||
return errors.Errorf("invalid type: %+v", dst)
|
return fmt.Errorf("invalid type: %+v", dst)
|
||||||
}
|
}
|
||||||
if srcProc, ok = src.Interface().(types.Processes); !ok {
|
if srcProc, ok = src.Interface().(types.Processes); !ok {
|
||||||
return errors.Errorf("invalid type: %+v", src)
|
return fmt.Errorf("invalid type: %+v", src)
|
||||||
}
|
}
|
||||||
merged, err := mergeProcesses(dstProc, srcProc)
|
merged, err := mergeProcesses(dstProc, srcProc)
|
||||||
dst.Set(reflect.ValueOf(merged))
|
dst.Set(reflect.ValueOf(merged))
|
||||||
|
Loading…
Reference in New Issue
Block a user