diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 90586bb..4db857c 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -15,11 +15,11 @@ jobs: - uses: actions/setup-go@v3 with: - go-version: "1.22" + go-version: "1.23" - uses: golangci/golangci-lint-action@v3 with: - version: v1.59.1 + version: v1.61.0 go-mod-tidy: runs-on: ubuntu-22.04 @@ -29,7 +29,7 @@ jobs: - uses: actions/setup-go@v3 with: - go-version: "1.22" + go-version: "1.23" - run: | go mod tidy diff --git a/.github/workflows/msgs.yml b/.github/workflows/msgs.yml index 990a95c..ba0fefd 100644 --- a/.github/workflows/msgs.yml +++ b/.github/workflows/msgs.yml @@ -12,7 +12,7 @@ jobs: steps: - uses: actions/setup-go@v3 with: - go-version: "1.22" + go-version: "1.23" - run: go install mvdan.cc/gofumpt@v0.5.0 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7590f77..1b708f9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-22.04 strategy: matrix: - go: ["1.20", "1.21", "1.22"] + go: ["1.21", "1.22", "1.23"] steps: - uses: actions/checkout@v4 @@ -22,7 +22,7 @@ jobs: - run: make test-nodocker - - if: matrix.go == '1.22' + - if: matrix.go == '1.23' uses: codecov/codecov-action@v3 with: token: ${{ secrets.CODECOV_TOKEN }} diff --git a/Makefile b/Makefile index c0a17ea..c781ed8 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ -BASE_IMAGE = golang:1.22-alpine3.18 -LINT_IMAGE = golangci/golangci-lint:v1.59.1 +BASE_IMAGE = golang:1.23-alpine3.20 +LINT_IMAGE = golangci/golangci-lint:v1.61.0 .PHONY: $(shell ls) diff --git a/README.md b/README.md index a42079f..e832f14 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ Features: ## Installation -1. Install Go ≥ 1.20. +1. Install Go ≥ 1.21. 2. Create an empty folder, open a terminal in it and initialize the Go modules system: diff --git a/action_client.go b/action_client.go index e298d30..f8892be 100644 --- a/action_client.go +++ b/action_client.go @@ -460,7 +460,7 @@ func NewActionClient(conf ActionClientConf) (*ActionClient, error) { Node: conf.Node, Topic: conf.Name + "/feedback", Callback: reflect.MakeFunc( - reflect.FuncOf([]reflect.Type{reflect.PtrTo(ac.fbActionType)}, []reflect.Type{}, false), + reflect.FuncOf([]reflect.Type{reflect.PointerTo(ac.fbActionType)}, []reflect.Type{}, false), ac.onFeedback, ).Interface(), onPublisher: func() { @@ -481,7 +481,7 @@ func NewActionClient(conf ActionClientConf) (*ActionClient, error) { Node: conf.Node, Topic: conf.Name + "/result", Callback: reflect.MakeFunc( - reflect.FuncOf([]reflect.Type{reflect.PtrTo(ac.resActionType)}, []reflect.Type{}, false), + reflect.FuncOf([]reflect.Type{reflect.PointerTo(ac.resActionType)}, []reflect.Type{}, false), ac.onResult, ).Interface(), onPublisher: func() { @@ -589,9 +589,9 @@ func (ac *ActionClient) SendGoal(conf ActionClientGoalConf) (*ActionClientGoalHa if conf.Goal == nil { return nil, fmt.Errorf("Goal is empty") } - if reflect.TypeOf(conf.Goal) != reflect.PtrTo(ac.goalType) { + if reflect.TypeOf(conf.Goal) != reflect.PointerTo(ac.goalType) { return nil, fmt.Errorf("Goal must be %s, while is %v", - reflect.PtrTo(ac.goalType), reflect.TypeOf(conf.Goal)) + reflect.PointerTo(ac.goalType), reflect.TypeOf(conf.Goal)) } if conf.OnTransition != nil { @@ -611,9 +611,9 @@ func (ac *ActionClient) SendGoal(conf ActionClientGoalConf) (*ActionClientGoalHa if cbt.NumOut() != 0 { return nil, fmt.Errorf("OnTransition must not return any value") } - if cbt.In(1) != reflect.PtrTo(ac.resType) { + if cbt.In(1) != reflect.PointerTo(ac.resType) { return nil, fmt.Errorf("OnTransition 2nd argument must be %s, while is %v", - reflect.PtrTo(ac.resType), cbt.In(1)) + reflect.PointerTo(ac.resType), cbt.In(1)) } } @@ -628,9 +628,9 @@ func (ac *ActionClient) SendGoal(conf ActionClientGoalConf) (*ActionClientGoalHa if cbt.NumOut() != 0 { return nil, fmt.Errorf("OnFeedback must not return any value") } - if cbt.In(0) != reflect.PtrTo(ac.fbType) { + if cbt.In(0) != reflect.PointerTo(ac.fbType) { return nil, fmt.Errorf("OnFeedback 1st argument must must be %s, while is %v", - reflect.PtrTo(ac.fbType), cbt.In(1)) + reflect.PointerTo(ac.fbType), cbt.In(1)) } } diff --git a/action_client_test.go b/action_client_test.go index ce8638e..2d2924e 100644 --- a/action_client_test.go +++ b/action_client_test.go @@ -128,7 +128,7 @@ func TestActionClient(t *testing.T) { Node: ns, Topic: "test_action/goal", Callback: reflect.MakeFunc( - reflect.FuncOf([]reflect.Type{reflect.PtrTo(reflect.TypeOf(goalAction))}, []reflect.Type{}, false), + reflect.FuncOf([]reflect.Type{reflect.PointerTo(reflect.TypeOf(goalAction))}, []reflect.Type{}, false), func(in []reflect.Value) []reflect.Value { go func() { goalID := in[0].Elem().FieldByName("GoalId"). diff --git a/action_server.go b/action_server.go index 2a149b5..5057b3b 100644 --- a/action_server.go +++ b/action_server.go @@ -62,9 +62,9 @@ type ActionServerGoalHandler struct { // PublishFeedback publishes a feedback about the goal, func (gh *ActionServerGoalHandler) PublishFeedback(fb interface{}) { - if reflect.TypeOf(fb) != reflect.PtrTo(gh.as.fbType) { + if reflect.TypeOf(fb) != reflect.PointerTo(gh.as.fbType) { panic(fmt.Errorf("argument must be %s, while is %v", - reflect.PtrTo(gh.as.fbType), reflect.TypeOf(fb))) + reflect.PointerTo(gh.as.fbType), reflect.TypeOf(fb))) } gh.as.mutex.Lock() @@ -90,9 +90,9 @@ func (gh *ActionServerGoalHandler) PublishFeedback(fb interface{}) { } func (gh *ActionServerGoalHandler) publishResult(res interface{}) { - if reflect.TypeOf(res) != reflect.PtrTo(gh.as.resType) { + if reflect.TypeOf(res) != reflect.PointerTo(gh.as.resType) { panic(fmt.Errorf("argument must be %s, while is %v", - reflect.PtrTo(gh.as.resType), reflect.TypeOf(res))) + reflect.PointerTo(gh.as.resType), reflect.TypeOf(res))) } gh.as.conf.Node.Log(LogLevelDebug, "action server '%s' has finished goal '%s' with state '%s'", @@ -315,9 +315,9 @@ func NewActionServer(conf ActionServerConf) (*ActionServer, error) { return nil, fmt.Errorf("OnGoal 1st argument must be %s, while is %v", reflect.TypeOf(&ActionServerGoalHandler{}), cbt.In(0)) } - if cbt.In(1) != reflect.PtrTo(as.goalType) { + if cbt.In(1) != reflect.PointerTo(as.goalType) { return nil, fmt.Errorf("OnGoal 2nd argument must be %s, while is %v", - reflect.PtrTo(as.goalType), cbt.In(1)) + reflect.PointerTo(as.goalType), cbt.In(1)) } if cbt.NumOut() != 0 { @@ -359,7 +359,7 @@ func NewActionServer(conf ActionServerConf) (*ActionServer, error) { Node: conf.Node, Topic: conf.Name + "/goal", Callback: reflect.MakeFunc( - reflect.FuncOf([]reflect.Type{reflect.PtrTo(reflect.TypeOf(goalAction))}, []reflect.Type{}, false), + reflect.FuncOf([]reflect.Type{reflect.PointerTo(reflect.TypeOf(goalAction))}, []reflect.Type{}, false), as.onGoal, ).Interface(), }) diff --git a/action_server_test.go b/action_server_test.go index b599e06..47f4ede 100644 --- a/action_server_test.go +++ b/action_server_test.go @@ -110,7 +110,7 @@ func TestActionServer(t *testing.T) { Node: nc, Topic: "test_action/feedback", Callback: reflect.MakeFunc( - reflect.FuncOf([]reflect.Type{reflect.PtrTo(reflect.TypeOf(fbAction))}, []reflect.Type{}, false), + reflect.FuncOf([]reflect.Type{reflect.PointerTo(reflect.TypeOf(fbAction))}, []reflect.Type{}, false), func(in []reflect.Value) []reflect.Value { require.Equal(t, DoSomethingActionFeedback{0.5}, in[0].Elem().FieldByName("Feedback").Interface()) close(fbRecv) @@ -125,7 +125,7 @@ func TestActionServer(t *testing.T) { Node: nc, Topic: "test_action/result", Callback: reflect.MakeFunc( - reflect.FuncOf([]reflect.Type{reflect.PtrTo(reflect.TypeOf(resAction))}, []reflect.Type{}, false), + reflect.FuncOf([]reflect.Type{reflect.PointerTo(reflect.TypeOf(resAction))}, []reflect.Type{}, false), func(in []reflect.Value) []reflect.Value { require.Equal(t, DoSomethingActionResult{123456}, in[0].Elem().FieldByName("Result").Interface()) close(resRecv) @@ -211,7 +211,7 @@ func TestActionServerCancelGoal(t *testing.T) { Node: nc, Topic: "test_action/result", Callback: reflect.MakeFunc( - reflect.FuncOf([]reflect.Type{reflect.PtrTo(reflect.TypeOf(resAction))}, []reflect.Type{}, false), + reflect.FuncOf([]reflect.Type{reflect.PointerTo(reflect.TypeOf(resAction))}, []reflect.Type{}, false), func(_ []reflect.Value) []reflect.Value { close(resRecv) return nil diff --git a/go.mod b/go.mod index 3d36ca5..45a9511 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/bluenviron/goroslib/v2 -go 1.20 +go 1.21 require ( github.com/alecthomas/kong v1.2.1 diff --git a/go.sum b/go.sum index bc32e76..9823b6a 100644 --- a/go.sum +++ b/go.sum @@ -6,11 +6,15 @@ github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5 github.com/ProtonMail/go-crypto v1.0.0 h1:LRuvITjQWX+WIfr930YHG2HNfjR1uOfyf5vE0kC2U78= github.com/ProtonMail/go-crypto v1.0.0/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0= github.com/alecthomas/assert/v2 v2.10.0 h1:jjRCHsj6hBJhkmhznrCzoNpbA3zqy0fYiUcYZP/GkPY= +github.com/alecthomas/assert/v2 v2.10.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k= github.com/alecthomas/kong v1.2.1 h1:E8jH4Tsgv6wCRX2nGrdPyHDUCSG83WH2qE4XLACD33Q= github.com/alecthomas/kong v1.2.1/go.mod h1:rKTSFhbdp3Ryefn8x5MOEprnRFQ7nlmMC01GKhehhBM= github.com/alecthomas/repr v0.4.0 h1:GhI2A8MACjfegCPVq9f1FLvIBS+DrQ2KQBFZP1iFzXc= +github.com/alecthomas/repr v0.4.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4= github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8= +github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuWl6zY27l47sB3qLNK6tF2fkHG55UZxx8oIVo4= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= +github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA= github.com/cloudflare/circl v1.3.7 h1:qlCDlTPz2n9fu58M0Nh1J/JzcFpfgkFHHX3O35r5vcU= @@ -21,32 +25,40 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/elazarl/goproxy v0.0.0-20230808193330-2592e75ae04a h1:mATvB/9r/3gvcejNsXKSkQ6lcIaNec2nyfOdlTBR2lU= +github.com/elazarl/goproxy v0.0.0-20230808193330-2592e75ae04a/go.mod h1:Ro8st/ElPeALwNFlcTpWmkr6IoMFfkjXAvTHpevnDsM= github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ= github.com/gliderlabs/ssh v0.3.7 h1:iV3Bqi942d9huXnzEF2Mt+CY9gLu8DNM4Obd+8bODRE= +github.com/gliderlabs/ssh v0.3.7/go.mod h1:zpHEXBstFnQYtGnB8k8kQLol82umzn/2/snG7alWVD8= github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI= github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic= github.com/go-git/go-billy/v5 v5.5.0 h1:yEY4yhzCDuMGSv83oGxiBotRzhwhNr8VZyphhiu+mTU= github.com/go-git/go-billy/v5 v5.5.0/go.mod h1:hmexnoNsr2SJU1Ju67OaNz5ASJY3+sHgFRpCtpDCKow= github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399 h1:eMje31YglSBqCdIqdhKBW8lokaMrL3uTkpGYlE2OOT4= +github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399/go.mod h1:1OCfN199q1Jm3HZlxleg+Dw/mwps2Wbk9frAWm+4FII= github.com/go-git/go-git/v5 v5.12.0 h1:7Md+ndsjrzZxbddRDZjF14qK+NN56sy6wkqaVrjZtys= github.com/go-git/go-git/v5 v5.12.0/go.mod h1:FTM9VKtnI2m65hNI/TenDDDnUf2Q9FHnXYjuz9i5OEY= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/gookit/color v1.5.4 h1:FZmqs7XOyGgCAxmWyPslpiok1k05wmY3SJTytgvYFs0= github.com/gookit/color v1.5.4/go.mod h1:pZJOeOS8DM43rXbp4AZo1n9zCU2qjpcRko0b6/QJi9w= github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM= +github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4= github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI= +github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M= github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4= github.com/pjbgf/sha1cd v0.3.0/go.mod h1:nZ1rrWOcGJ5uZgEEVL1VUM9iRQiZvWdbZjkKyFzPPsI= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -54,6 +66,7 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE 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/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= +github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8= github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4= github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= @@ -93,6 +106,7 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= +golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -114,6 +128,7 @@ golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8= +golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= @@ -122,6 +137,7 @@ golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= @@ -132,6 +148,7 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME= gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/service_client.go b/service_client.go index dcd1d76..655af80 100644 --- a/service_client.go +++ b/service_client.go @@ -2,6 +2,7 @@ package goroslib import ( "context" + "errors" "fmt" "net" "reflect" @@ -227,7 +228,7 @@ func (sc *ServiceClient) createConn(ctx context.Context) error { if strErr, ok := raw["error"]; ok { nconn.Close() - return fmt.Errorf(strErr) + return errors.New(strErr) } var outHeader prototcp.HeaderServiceProvider diff --git a/simple_action_client.go b/simple_action_client.go index 056e0dc..99e7d00 100644 --- a/simple_action_client.go +++ b/simple_action_client.go @@ -110,9 +110,9 @@ func (sac *SimpleActionClient) SendGoal(conf SimpleActionClientGoalConf) error { return fmt.Errorf("OnDone 1st argument must be %s, while is %v", reflect.TypeOf(SimpleActionClientGoalState(0)), cbt.In(0)) } - if cbt.In(1) != reflect.PtrTo(sac.ac.resType) { + if cbt.In(1) != reflect.PointerTo(sac.ac.resType) { return fmt.Errorf("OnDone 2nd argument must be %s, while is %v", - reflect.PtrTo(sac.ac.resType), cbt.In(1)) + reflect.PointerTo(sac.ac.resType), cbt.In(1)) } if cbt.NumOut() != 0 { @@ -129,9 +129,9 @@ func (sac *SimpleActionClient) SendGoal(conf SimpleActionClientGoalConf) error { if cbt.NumIn() != 1 { return fmt.Errorf("OnFeedback must accept a single argument") } - if cbt.In(0) != reflect.PtrTo(sac.ac.fbType) { + if cbt.In(0) != reflect.PointerTo(sac.ac.fbType) { return fmt.Errorf("OnFeedback 1st argument must be %s, while is %v", - reflect.PtrTo(sac.ac.fbType), cbt.In(0)) + reflect.PointerTo(sac.ac.fbType), cbt.In(0)) } if cbt.NumOut() != 0 { @@ -153,7 +153,7 @@ func (sac *SimpleActionClient) SendGoal(conf SimpleActionClientGoalConf) error { OnTransition: reflect.MakeFunc( reflect.FuncOf([]reflect.Type{ reflect.TypeOf(&ActionClientGoalHandler{}), - reflect.PtrTo(sac.ac.resType), + reflect.PointerTo(sac.ac.resType), }, []reflect.Type{}, false), func(in []reflect.Value) []reflect.Value { return sac.onTransition(fixedSGH, in) @@ -161,7 +161,7 @@ func (sac *SimpleActionClient) SendGoal(conf SimpleActionClientGoalConf) error { ).Interface(), OnFeedback: reflect.MakeFunc( reflect.FuncOf([]reflect.Type{ - reflect.PtrTo(sac.ac.fbType), + reflect.PointerTo(sac.ac.fbType), }, []reflect.Type{}, false), func(in []reflect.Value) []reflect.Value { return sac.onFeedback(fixedSGH, in) diff --git a/simple_action_server.go b/simple_action_server.go index 2c2fc7d..ff466e5 100644 --- a/simple_action_server.go +++ b/simple_action_server.go @@ -86,9 +86,9 @@ func NewSimpleActionServer(conf SimpleActionServerConf) (*SimpleActionServer, er return nil, fmt.Errorf("OnExecute 1st argument must be %s, while is %v", reflect.TypeOf(&SimpleActionServer{}), cbt.In(0)) } - if cbt.In(1) != reflect.PtrTo(reflect.TypeOf(goal)) { + if cbt.In(1) != reflect.PointerTo(reflect.TypeOf(goal)) { return nil, fmt.Errorf("OnExecute 2nd argument must be %s, while is %v", - reflect.PtrTo(reflect.TypeOf(goal)), cbt.In(1)) + reflect.PointerTo(reflect.TypeOf(goal)), cbt.In(1)) } if cbt.NumOut() != 0 { @@ -103,7 +103,7 @@ func NewSimpleActionServer(conf SimpleActionServerConf) (*SimpleActionServer, er OnGoal: reflect.MakeFunc( reflect.FuncOf([]reflect.Type{ reflect.TypeOf(&ActionServerGoalHandler{}), - reflect.PtrTo(reflect.TypeOf(goal)), + reflect.PointerTo(reflect.TypeOf(goal)), }, []reflect.Type{}, false), sas.onGoal, ).Interface(), diff --git a/subscriber_pub.go b/subscriber_pub.go index 12d8313..18baa66 100644 --- a/subscriber_pub.go +++ b/subscriber_pub.go @@ -267,7 +267,7 @@ func (sp *subscriberPublisher) runInnerTCP(proto []interface{}) error { } if strErr, ok := raw["error"]; ok { - err = fmt.Errorf(strErr) + err = errors.New(strErr) return }