Skip to content

Commit d17b09d

Browse files
RSDK-5169 RSDK-4916 update dependencies and docs (#4)
Co-authored-by: Maxim Pertsov <[email protected]>
1 parent 17ea94a commit d17b09d

File tree

8 files changed

+344
-278
lines changed

8 files changed

+344
-278
lines changed

.github/workflows/deploy.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ jobs:
1414
- uses: actions/checkout@v3
1515
- uses: actions/setup-go@v4
1616
with:
17-
go-version: '~1.20.6'
17+
go-version: '1.20'
1818
- name: deps
1919
run: go mod download
2020
- name: build
2121
run: |
22-
GOARCH=arm64 make module.tar.gz && mv module.tar.gz module-arm64.tar.gz
23-
GOARCH=amd64 make module.tar.gz && mv module.tar.gz module-amd64.tar.gz
22+
GOARCH=arm64 make --always-make module.tar.gz && mv module.tar.gz module-arm64.tar.gz
23+
GOARCH=amd64 make --always-make module.tar.gz && mv module.tar.gz module-amd64.tar.gz
2424
- uses: viamrobotics/upload-module@main
2525
if: github.event_name == 'release'
2626
with:

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515
# vendor/
1616

1717
wifi
18-
module.tar.gz
18+
*.tar.gz

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
wifi: *.go */*.go
1+
wifi: *.go */*.go go.*
22
# the executable
33
go build -o $@ -ldflags "-s -w" -tags osusergo,netgo
44
file $@

README.md

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,45 @@
11
# wifi-sensor
22

3-
A sensor that detects wifi strength
3+
A Viam sensor implementation that reads the system's wifi information. This is an example repo to show how to:
4+
1. Make a Viam module with Go
5+
1. Build it in CI and upload to the registry
46

5-
## Usage
7+
## Running this with local exec
68

7-
### 1. Build binary
9+
For iterative development, you can run a module locally (laptop or robot) and test it using a local instance of the RDK.
810

9-
If you clone this repository to the target environment where you run your Viam robot, then you can build a binary named `wifi` with:
11+
Create the binary with `make wifi`.
1012

11-
```
12-
go build -o wifi
13-
```
14-
15-
Alternatively, if you want to build a binary for a different target environment, please use the [viam canon tool](https://github.com/viamrobotics/canon).
16-
17-
### 2. Add to robot configuration
13+
Your config will look something like this (replace /path/to/wifi-sensor with the actual path on your system):
1814

19-
Copy the binary to the robot (system where viam-server is running) and add the following to your configuration:
20-
21-
```
22-
...
23-
"modules": [
24-
...,
15+
```json
16+
{
17+
"components": [
2518
{
26-
"executable_path": "<path_to_binary>",
27-
"name": "wifisensor"
28-
},
29-
...,
19+
"name": "whatever",
20+
"model": "viam:sensor:linux-wifi",
21+
"type": "sensor"
22+
}
3023
],
31-
"components": [
32-
...,
24+
"modules": [
3325
{
3426
"name": "wifi",
35-
"type": "sensor",
36-
"model": "viam-labs:sensor:linux-wifi"
37-
},
38-
...,
39-
],
40-
...
27+
"executable_path": "/path/to/wifi-sensor/wifi",
28+
"type": "local"
29+
}
30+
]
31+
}
4132
```
4233

43-
For more information on how to configure modular components, [see this example](https://docs.viam.com/services/slam/run-slam-cartographer/#step-1-add-your-rdiplar-as-a-modular-component).
34+
Our docs for running local modules are [here](https://docs.viam.com/extend/modular-resources/configure/#local-modules).
35+
36+
## What's in this repo
37+
38+
- .github/workflows: CI and deploy logic
39+
- Makefile: instructions for building the binary and bundling it into a tarball
40+
- \*.go: the implementation
41+
- meta.json: module configuration file
42+
43+
## Forking this repo
44+
45+
If you fork this and want to deploy to the registry, you'll need to update namespaces and CI secrets. Full fork instructions are in the [Python module example](https://github.com/viam-labs/python-example-module#forking-this-repo).

go.mod

Lines changed: 72 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -5,126 +5,131 @@ go 1.19
55
require (
66
github.com/edaniels/golog v0.0.0-20230215213219-28954395e8d0
77
github.com/pkg/errors v0.9.1
8-
go.viam.com/rdk v0.2.19
9-
go.viam.com/test v1.1.1-0.20220909204145-f61b7c01c33e
10-
go.viam.com/utils v0.1.12
8+
go.viam.com/rdk v0.9.1
9+
go.viam.com/test v1.1.1-0.20220913152726-5da9916c08a2
10+
go.viam.com/utils v0.1.43
1111
)
1212

1313
require (
14-
cloud.google.com/go v0.105.0 // indirect
15-
cloud.google.com/go/compute v1.13.0 // indirect
16-
cloud.google.com/go/compute/metadata v0.2.1 // indirect
17-
cloud.google.com/go/iam v0.8.0 // indirect
18-
cloud.google.com/go/storage v1.27.0 // indirect
14+
cloud.google.com/go v0.110.0 // indirect
15+
cloud.google.com/go/compute v1.19.0 // indirect
16+
cloud.google.com/go/compute/metadata v0.2.3 // indirect
17+
cloud.google.com/go/iam v0.13.0 // indirect
18+
cloud.google.com/go/storage v1.30.1 // indirect
1919
git.sr.ht/~sbinet/gg v0.3.1 // indirect
20-
github.com/a8m/envsubst v1.3.0 // indirect
20+
github.com/a8m/envsubst v1.4.2 // indirect
2121
github.com/ajstarks/svgo v0.0.0-20211024235047-1546f124cd8b // indirect
22-
github.com/benbjohnson/clock v1.3.0 // indirect
22+
github.com/benbjohnson/clock v1.3.3 // indirect
2323
github.com/bep/debounce v1.2.1 // indirect
24+
github.com/bufbuild/protocompile v0.5.1 // indirect
2425
github.com/campoy/embedmd v1.0.0 // indirect
2526
github.com/cenkalti/backoff v2.2.1+incompatible // indirect
26-
github.com/cenkalti/backoff/v4 v4.2.0 // indirect
27-
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.0-20210816181553-5444fa50b93d // indirect
27+
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
28+
github.com/davecgh/go-spew v1.1.1 // indirect
29+
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
2830
github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect
29-
github.com/docker/go-units v0.4.0 // indirect
31+
github.com/docker/go-units v0.5.0 // indirect
3032
github.com/edaniels/lidario v0.0.0-20220607182921-5879aa7b96dd // indirect
31-
github.com/edaniels/zeroconf v1.0.5 // indirect
33+
github.com/edaniels/zeroconf v1.0.10 // indirect
3234
github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5 // indirect
33-
github.com/fsnotify/fsnotify v1.5.4 // indirect
35+
github.com/fsnotify/fsnotify v1.6.0 // indirect
3436
github.com/fullstorydev/grpcurl v1.8.6 // indirect
35-
github.com/go-fonts/liberation v0.2.0 // indirect
37+
github.com/go-fonts/liberation v0.3.0 // indirect
3638
github.com/go-gl/mathgl v1.0.0 // indirect
37-
github.com/go-latex/latex v0.0.0-20210823091927-c0d11ff05a81 // indirect
39+
github.com/go-latex/latex v0.0.0-20230307184459-12ec69307ad9 // indirect
3840
github.com/go-pdf/fpdf v0.6.0 // indirect
39-
github.com/goccy/go-json v0.9.7 // indirect
40-
github.com/golang-jwt/jwt/v4 v4.4.3 // indirect
41+
github.com/goccy/go-json v0.10.2 // indirect
42+
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
4143
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect
4244
github.com/golang/geo v0.0.0-20210211234256-740aa86cb551 // indirect
4345
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
44-
github.com/golang/protobuf v1.5.2 // indirect
46+
github.com/golang/protobuf v1.5.3 // indirect
4547
github.com/golang/snappy v0.0.4 // indirect
4648
github.com/gonuts/binary v0.2.0 // indirect
4749
github.com/google/go-cmp v0.5.9 // indirect
4850
github.com/google/uuid v1.3.0 // indirect
49-
github.com/googleapis/enterprise-certificate-proxy v0.2.0 // indirect
50-
github.com/googleapis/gax-go/v2 v2.7.0 // indirect
51-
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
52-
github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.0 // indirect
51+
github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect
52+
github.com/googleapis/gax-go/v2 v2.8.0 // indirect
53+
github.com/gorilla/securecookie v1.1.1 // indirect
54+
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect
55+
github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.2 // indirect
5356
github.com/improbable-eng/grpc-web v0.15.0 // indirect
54-
github.com/jedib0t/go-pretty/v6 v6.3.3 // indirect
55-
github.com/jhump/protoreflect v1.12.1-0.20220417024638-438db461d753 // indirect
57+
github.com/jedib0t/go-pretty/v6 v6.4.6 // indirect
58+
github.com/jhump/protoreflect v1.15.1 // indirect
5659
github.com/kellydunn/golang-geo v0.7.0 // indirect
57-
github.com/klauspost/compress v1.15.15 // indirect
60+
github.com/klauspost/compress v1.16.5 // indirect
5861
github.com/kylelemons/go-gypsy v1.0.0 // indirect
5962
github.com/lestrrat-go/backoff/v2 v2.0.8 // indirect
60-
github.com/lestrrat-go/blackmagic v1.0.0 // indirect
63+
github.com/lestrrat-go/blackmagic v1.0.1 // indirect
6164
github.com/lestrrat-go/httpcc v1.0.1 // indirect
62-
github.com/lestrrat-go/iter v1.0.1 // indirect
65+
github.com/lestrrat-go/iter v1.0.2 // indirect
6366
github.com/lestrrat-go/jwx v1.2.25 // indirect
64-
github.com/lestrrat-go/option v1.0.0 // indirect
65-
github.com/lib/pq v1.10.6 // indirect
67+
github.com/lestrrat-go/option v1.0.1 // indirect
68+
github.com/lib/pq v1.10.7 // indirect
6669
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
67-
github.com/mattn/go-runewidth v0.0.13 // indirect
68-
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
69-
github.com/miekg/dns v1.1.50 // indirect
70+
github.com/mattn/go-runewidth v0.0.14 // indirect
71+
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
72+
github.com/miekg/dns v1.1.53 // indirect
7073
github.com/mitchellh/copystructure v1.2.0 // indirect
7174
github.com/mitchellh/mapstructure v1.5.0 // indirect
7275
github.com/mitchellh/reflectwalk v1.0.2 // indirect
7376
github.com/montanaflynn/stats v0.7.0 // indirect
7477
github.com/pion/datachannel v1.5.5 // indirect
75-
github.com/pion/dtls/v2 v2.2.4 // indirect
76-
github.com/pion/ice/v2 v2.3.0 // indirect
77-
github.com/pion/interceptor v0.1.12 // indirect
78+
github.com/pion/dtls/v2 v2.2.7 // indirect
79+
github.com/pion/ice/v2 v2.3.9 // indirect
80+
github.com/pion/interceptor v0.1.17 // indirect
7881
github.com/pion/logging v0.2.2 // indirect
79-
github.com/pion/mdns v0.0.7 // indirect
82+
github.com/pion/mdns v0.0.8-0.20230502060824-17c664ea7d5c // indirect
8083
github.com/pion/randutil v0.1.0 // indirect
8184
github.com/pion/rtcp v1.2.10 // indirect
8285
github.com/pion/rtp v1.7.13 // indirect
83-
github.com/pion/sctp v1.8.6 // indirect
86+
github.com/pion/sctp v1.8.7 // indirect
8487
github.com/pion/sdp/v3 v3.0.6 // indirect
85-
github.com/pion/srtp/v2 v2.0.12 // indirect
86-
github.com/pion/stun v0.4.0 // indirect
87-
github.com/pion/transport/v2 v2.0.1 // indirect
88-
github.com/pion/turn/v2 v2.1.0 // indirect
89-
github.com/pion/udp v0.1.4 // indirect
90-
github.com/pion/webrtc/v3 v3.1.54 // indirect
88+
github.com/pion/srtp/v2 v2.0.15 // indirect
89+
github.com/pion/stun v0.6.1 // indirect
90+
github.com/pion/transport/v2 v2.2.1 // indirect
91+
github.com/pion/turn/v2 v2.1.2 // indirect
92+
github.com/pion/webrtc/v3 v3.2.11 // indirect
9193
github.com/pmezard/go-difflib v1.0.0 // indirect
92-
github.com/rivo/uniseg v0.2.0 // indirect
93-
github.com/rs/cors v1.8.3 // indirect
94-
github.com/sergi/go-diff v1.2.0 // indirect
95-
github.com/smartystreets/assertions v1.2.0 // indirect
94+
github.com/rivo/uniseg v0.4.4 // indirect
95+
github.com/rs/cors v1.9.0 // indirect
96+
github.com/sergi/go-diff v1.3.1 // indirect
97+
github.com/smartystreets/assertions v1.13.0 // indirect
9698
github.com/srikrsna/protoc-gen-gotag v0.6.2 // indirect
99+
github.com/stretchr/testify v1.8.4 // indirect
97100
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
98101
github.com/xdg-go/scram v1.1.2 // indirect
99102
github.com/xdg-go/stringprep v1.0.4 // indirect
100103
github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a // indirect
104+
github.com/zitadel/oidc v1.13.4 // indirect
101105
github.com/ziutek/mymysql v1.5.4 // indirect
102-
go-hep.org/x/hep v0.31.1 // indirect
106+
go-hep.org/x/hep v0.32.1 // indirect
103107
go.mongodb.org/mongo-driver v1.12.0-prerelease.0.20221109213319-d3466eeae7a7 // indirect
104108
go.opencensus.io v0.24.0 // indirect
105109
go.uber.org/atomic v1.10.0 // indirect
106-
go.uber.org/goleak v1.2.0 // indirect
107-
go.uber.org/multierr v1.9.0 // indirect
110+
go.uber.org/goleak v1.2.1 // indirect
111+
go.uber.org/multierr v1.11.0 // indirect
108112
go.uber.org/zap v1.24.0 // indirect
109-
go.viam.com/api v0.1.75 // indirect
110-
golang.org/x/crypto v0.6.0 // indirect
111-
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect
112-
golang.org/x/image v0.3.0 // indirect
113-
golang.org/x/mod v0.8.0 // indirect
114-
golang.org/x/net v0.6.0 // indirect
115-
golang.org/x/oauth2 v0.3.0 // indirect
113+
go.viam.com/api v0.1.186 // indirect
114+
golang.org/x/crypto v0.10.0 // indirect
115+
golang.org/x/exp v0.0.0-20230321023759-10a507213a29 // indirect
116+
golang.org/x/image v0.8.0 // indirect
117+
golang.org/x/mod v0.10.0 // indirect
118+
golang.org/x/net v0.11.0 // indirect
119+
golang.org/x/oauth2 v0.7.0 // indirect
116120
golang.org/x/sync v0.1.0 // indirect
117-
golang.org/x/sys v0.5.0 // indirect
118-
golang.org/x/text v0.7.0 // indirect
119-
golang.org/x/tools v0.6.0 // indirect
121+
golang.org/x/sys v0.9.0 // indirect
122+
golang.org/x/text v0.10.0 // indirect
123+
golang.org/x/tools v0.8.0 // indirect
120124
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
121125
gonum.org/v1/gonum v0.12.0 // indirect
122-
gonum.org/v1/plot v0.11.0 // indirect
123-
google.golang.org/api v0.103.0 // indirect
126+
gonum.org/v1/plot v0.12.0 // indirect
127+
google.golang.org/api v0.114.0 // indirect
124128
google.golang.org/appengine v1.6.7 // indirect
125-
google.golang.org/genproto v0.0.0-20230202175211-008b39050e57 // indirect
126-
google.golang.org/grpc v1.52.3 // indirect
127-
google.golang.org/protobuf v1.28.1 // indirect
129+
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect
130+
google.golang.org/grpc v1.54.0 // indirect
131+
google.golang.org/protobuf v1.30.0 // indirect
132+
gopkg.in/square/go-jose.v2 v2.6.0 // indirect
128133
gopkg.in/yaml.v3 v3.0.1 // indirect
129134
nhooyr.io/websocket v1.8.7 // indirect
130135
)

0 commit comments

Comments
 (0)