commit | 0d6802eb80b5277936052d5117168d7cd90c7cd8 | [log] [tgz] |
---|---|---|
author | Christopher Collins <ccollins@apache.org> | Wed Feb 19 08:53:23 2020 -0800 |
committer | ccollins476ad <ccollins476ad@gmail.com> | Thu Feb 20 08:52:53 2020 -0800 |
tree | 804e25bce2f0867ceb17875579ae0db3e0461c4a | |
parent | 42db02b43d43104341c6bb292d86dc01c57d7a92 [diff] |
res: Use zero payload when no args specified This command: newtmgr res get /my/res should send a CoAP GET request with *no* payload. An optional payload can be specified with extra arguments after the resource name. Since there are no extra arguments, there should be no payload. Prior to this commit, newtmgr was including an empty map as the payload in such requests. The bug was caused by this quirk in Go: https://forum.golangbridge.org/t/a-nil-a-b-b-nil-with-pointers-and-interface/10593 In short, if `nil` is assigned to a variable of type `interface{}`, the variable will *not* compare equal to `nil`. An interface variable contains two pieces of information: 1) its type, and 2) its value. The variable is not equal to `nil` because `nil` is an *untyped* nil value. The solution is to return the untyped `nil` rather than the nil interface{}.
Newt Manager (newtmgr) is the application tool that enables a user to communicate with and manage remote devices running the Mynewt OS. It uses a connection profile to establish a connection with a device and sends command requests to the device. The newtmgr tool documentation can be found under /docs which are published at http://mynewt.apache.org/latest/os/modules/devmgmt/newtmgr.html
Build the newtmgr tool as follows:
apache-mynewt-newtmgr-1.3.0
directory to $GOPATH/src/mynewt.apache.org/newtmgr
cd $GOPATH/src/mynewt.apache.org/newtmgr/newtmgr
GO111MODULE=on go build