Convert to Go module.

This commit is contained in:
Robert Jacob 2018-10-27 16:46:37 +02:00
parent 240e3a4329
commit 5665783ef3
4 changed files with 51 additions and 7 deletions

View file

@ -2,17 +2,18 @@ FROM golang:1 AS builder
RUN apt-get update && apt-get install -y upx RUN apt-get update && apt-get install -y upx
ENV PACKAGE=github.com/xperimental/netatmo-exporter WORKDIR /build
RUN mkdir -p /go/src/${PACKAGE}
WORKDIR /go/src/${PACKAGE}
ENV LD_FLAGS="-w" ENV LD_FLAGS="-w"
ENV CGO_ENABLED=0 ENV CGO_ENABLED=0
COPY . /go/src/${PACKAGE} COPY go.mod go.sum /build/
RUN go mod download
RUN go mod verify
COPY . /build/
RUN echo "-- TEST" \ RUN echo "-- TEST" \
&& go test ./... \ && go test -cover ./... \
&& echo "-- BUILD" \ && echo "-- BUILD" \
&& go install -tags netgo -ldflags "${LD_FLAGS}" . \ && go install -tags netgo -ldflags "${LD_FLAGS}" . \
&& echo "-- PACK" \ && echo "-- PACK" \

View file

@ -12,10 +12,14 @@ The `latest` tag is built from the current master, tags tagged since the Docker
### Build from source ### Build from source
Because this program uses the "Go Module" feature introduced in Go 1.11, you'll need at least that version of Go for building it.
If you have a working Go installation, getting the binary should be as simple as If you have a working Go installation, getting the binary should be as simple as
```bash ```bash
go get github.com/xperimental/netatmo-exporter git clone https://github.com/xperimental/netatmo-exporter
cd netatmo-exporter
go build .
``` ```
There is also a `build-arm.sh` script if you want to run the exporter on an ARMv7 device. There is also a `build-arm.sh` script if you want to run the exporter on an ARMv7 device.

16
go.mod Normal file
View file

@ -0,0 +1,16 @@
module github.com/xperimental/netatmo-exporter
require (
github.com/beorn7/perks v0.0.0-20160804104726-4c0e84591b9a
github.com/exzz/netatmo-api-go v0.0.0-20171026152754-41589231f446
github.com/golang/protobuf v1.0.0
github.com/matttproud/golang_protobuf_extensions v1.0.0
github.com/prometheus/client_golang v0.8.0
github.com/prometheus/client_model v0.0.0-20171117100541-99fa1f4be8e5
github.com/prometheus/common v0.0.0-20180110214958-89604d197083
github.com/prometheus/procfs v0.0.0-20180212145926-282c8707aa21
github.com/spf13/pflag v1.0.0
golang.org/x/net v0.0.0-20180216171745-136a25c244d3
golang.org/x/oauth2 v0.0.0-20180207181906-543e37812f10
google.golang.org/appengine v1.0.0
)

23
go.sum Normal file
View file

@ -0,0 +1,23 @@
github.com/beorn7/perks v0.0.0-20160804104726-4c0e84591b9a h1:BtpsbiV638WQZwhA98cEZw2BsbnQJrbd0BI7tsy0W1c=
github.com/beorn7/perks v0.0.0-20160804104726-4c0e84591b9a/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/exzz/netatmo-api-go v0.0.0-20171026152754-41589231f446 h1:CDJQP0ptp6dNAtlftaydmh59BZE6Q4MGxMZXI7aZb44=
github.com/exzz/netatmo-api-go v0.0.0-20171026152754-41589231f446/go.mod h1:Rlj3fFpyVYt+Fghy6vdSrKCkO/QjjWCJC4mTfcxDYqM=
github.com/golang/protobuf v1.0.0 h1:lsek0oXi8iFE9L+EXARyHIjU5rlWIhhTkjDz3vHhWWQ=
github.com/golang/protobuf v1.0.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/matttproud/golang_protobuf_extensions v1.0.0 h1:YNOwxxSJzSUARoD9KRZLzM9Y858MNGCOACTvCW9TSAc=
github.com/matttproud/golang_protobuf_extensions v1.0.0/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/prometheus/client_golang v0.8.0 h1:1921Yw9Gc3iSc4VQh3PIoOqgPCZS7G/4xQNVUp8Mda8=
github.com/prometheus/client_golang v0.8.0/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
github.com/prometheus/client_model v0.0.0-20171117100541-99fa1f4be8e5 h1:cLL6NowurKLMfCeQy4tIeph12XNQWgANCNvdyrOYKV4=
github.com/prometheus/client_model v0.0.0-20171117100541-99fa1f4be8e5/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
github.com/prometheus/common v0.0.0-20180110214958-89604d197083 h1:BVsJT8+ZbyuL3hypz/HmEiM8h2P6hBQGig4el9/MdjA=
github.com/prometheus/common v0.0.0-20180110214958-89604d197083/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
github.com/prometheus/procfs v0.0.0-20180212145926-282c8707aa21 h1:BtGk8UpEtPwdp50zKGXocPgRI3CigPjsKIhVNIS1dtM=
github.com/prometheus/procfs v0.0.0-20180212145926-282c8707aa21/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/spf13/pflag v1.0.0 h1:oaPbdDe/x0UncahuwiPxW1GYJyilRAdsPnq3e1yaPcI=
github.com/spf13/pflag v1.0.0/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
golang.org/x/net v0.0.0-20180216171745-136a25c244d3 h1:ccQe92wkcq8fxMUi0JfXsoHS6cSzB4Gs6Y5M4UoTzJY=
golang.org/x/net v0.0.0-20180216171745-136a25c244d3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/oauth2 v0.0.0-20180207181906-543e37812f10 h1:ztZz7pTbygSoJgnsO6TYI8nOvZp3HowfTtpGeFuSu5g=
golang.org/x/oauth2 v0.0.0-20180207181906-543e37812f10/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
google.golang.org/appengine v1.0.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=