Skip to content

Commit 8d959b7

Browse files
aykevldeadprogram
authored andcommitted
all: replace dep with Go modules
We've moved to go modules, and keeping both working is burdensome. In fact, I think dep already wasn't working.
1 parent 02c4020 commit 8d959b7

File tree

5 files changed

+37
-97
lines changed

5 files changed

+37
-97
lines changed

.circleci/config.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,18 +61,19 @@ commands:
6161
- install-node
6262
- restore_cache:
6363
keys:
64-
- go-cache-{{ checksum "Gopkg.lock" }}-{{ .Environment.CIRCLE_PREVIOUS_BUILD_NUM }}
65-
- go-cache-{{ checksum "Gopkg.lock" }}
64+
- go-cache-v2-{{ checksum "go.mod" }}-{{ .Environment.CIRCLE_PREVIOUS_BUILD_NUM }}
65+
- go-cache-v2-{{ checksum "go.mod" }}
6666
- llvm-source-linux
6767
- run: go install .
6868
- run: go test -v
6969
- run: make gen-device -j4
7070
- run: make smoketest RISCV=0
7171
- save_cache:
72-
key: go-cache-{{ checksum "Gopkg.lock" }}-{{ .Environment.CIRCLE_BUILD_NUM }}
72+
key: go-cache-v2-{{ checksum "go.mod" }}-{{ .Environment.CIRCLE_BUILD_NUM }}
7373
paths:
7474
- ~/.cache/go-build
7575
- ~/.cache/tinygo
76+
- /go/pkg/mod
7677
- run: make fmt-check
7778
build-linux:
7879
steps:
@@ -95,8 +96,8 @@ commands:
9596
- install-node
9697
- restore_cache:
9798
keys:
98-
- go-cache-{{ checksum "Gopkg.lock" }}-{{ .Environment.CIRCLE_PREVIOUS_BUILD_NUM }}
99-
- go-cache-{{ checksum "Gopkg.lock" }}
99+
- go-cache-v2-{{ checksum "go.mod" }}-{{ .Environment.CIRCLE_PREVIOUS_BUILD_NUM }}
100+
- go-cache-v2-{{ checksum "go.mod" }}
100101
- llvm-source-linux
101102
- restore_cache:
102103
keys:
@@ -138,10 +139,11 @@ commands:
138139
- store_artifacts:
139140
path: /tmp/tinygo.linux-amd64.tar.gz
140141
- save_cache:
141-
key: go-cache-{{ checksum "Gopkg.lock" }}-{{ .Environment.CIRCLE_BUILD_NUM }}
142+
key: go-cache-v2-{{ checksum "go.mod" }}-{{ .Environment.CIRCLE_BUILD_NUM }}
142143
paths:
143144
- ~/.cache/go-build
144145
- ~/.cache/tinygo
146+
- /go/pkg/mod
145147
- run:
146148
name: "Extract release tarball"
147149
command: |

BUILDING.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ LLVM, Clang and LLD are quite light on dependencies, requiring only standard
1616
build tools to be built. Go is of course necessary to build TinyGo itself.
1717

1818
* Go (1.11+)
19-
* [dep](https://golang.github.io/dep/)
2019
* Standard build tools (gcc/clang)
2120
* git
2221
* CMake
@@ -28,15 +27,19 @@ on a different system like Mac.
2827
## Download the source
2928

3029
The first step is to download the TinyGo sources (use `--recursive` if you clone
31-
the git repository). Then, inside the directory, perform these steps:
30+
the git repository). Then, inside the directory, download the LLVM source:
3231

33-
dep ensure -vendor-only # download Go dependencies
34-
make llvm-source # download LLVM
32+
make llvm-source
3533

3634
You can also store LLVM outside of the TinyGo root directory by setting the
3735
`LLVM_BUILDDIR`, `CLANG_SRC` and `LLD_SRC` make variables, but that is not
3836
covered by this guide.
3937

38+
TinyGo uses Go modules, so if you clone TinyGo inside your GOPATH (and are using
39+
Go below 1.13), make sure that Go modules are enabled:
40+
41+
export GO111MODULE=on
42+
4043
## Build LLVM, Clang, LLD
4144

4245
Before starting the build, you may want to set the following environment

Dockerfile

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,23 @@ RUN wget -O- https://apt.llvm.org/llvm-snapshot.gpg.key| apt-key add - && \
66
apt-get update && \
77
apt-get install -y llvm-8-dev libclang-8-dev git
88

9-
RUN wget -O- https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
10-
11-
COPY . /go/src/github.com/tinygo-org/tinygo
9+
COPY . /tinygo
1210

1311
# remove submodules directories and re-init them to fix any hard-coded paths
1412
# after copying the tinygo directory in the previous step.
15-
RUN cd /go/src/github.com/tinygo-org/tinygo/ && \
13+
RUN cd /tinygo/ && \
1614
rm -rf ./lib/* && \
1715
git submodule update --init --recursive --force
1816

19-
RUN cd /go/src/github.com/tinygo-org/tinygo/ && \
20-
dep ensure --vendor-only && \
21-
go install /go/src/github.com/tinygo-org/tinygo/
17+
RUN cd /tinygo/ && \
18+
go install /tinygo/
2219

2320
# tinygo-wasm stage installs the needed dependencies to compile TinyGo programs for WASM.
2421
FROM tinygo-base AS tinygo-wasm
2522

2623
COPY --from=tinygo-base /go/bin/tinygo /go/bin/tinygo
27-
COPY --from=tinygo-base /go/src/github.com/tinygo-org/tinygo/src /go/src/github.com/tinygo-org/tinygo/src
28-
COPY --from=tinygo-base /go/src/github.com/tinygo-org/tinygo/targets /go/src/github.com/tinygo-org/tinygo/targets
24+
COPY --from=tinygo-base /tinygo/src /tinygo/src
25+
COPY --from=tinygo-base /tinygo/targets /tinygo/targets
2926

3027
RUN wget -O- https://apt.llvm.org/llvm-snapshot.gpg.key| apt-key add - && \
3128
echo "deb http://apt.llvm.org/buster/ llvm-toolchain-buster-8 main" >> /etc/apt/sources.list && \
@@ -36,13 +33,13 @@ RUN wget -O- https://apt.llvm.org/llvm-snapshot.gpg.key| apt-key add - && \
3633
FROM tinygo-base AS tinygo-avr
3734

3835
COPY --from=tinygo-base /go/bin/tinygo /go/bin/tinygo
39-
COPY --from=tinygo-base /go/src/github.com/tinygo-org/tinygo/src /go/src/github.com/tinygo-org/tinygo/src
40-
COPY --from=tinygo-base /go/src/github.com/tinygo-org/tinygo/targets /go/src/github.com/tinygo-org/tinygo/targets
41-
COPY --from=tinygo-base /go/src/github.com/tinygo-org/tinygo/Makefile /go/src/github.com/tinygo-org/tinygo/
42-
COPY --from=tinygo-base /go/src/github.com/tinygo-org/tinygo/tools /go/src/github.com/tinygo-org/tinygo/tools
43-
COPY --from=tinygo-base /go/src/github.com/tinygo-org/tinygo/lib /go/src/github.com/tinygo-org/tinygo/lib
36+
COPY --from=tinygo-base /tinygo/src /tinygo/src
37+
COPY --from=tinygo-base /tinygo/targets /tinygo/targets
38+
COPY --from=tinygo-base /tinygo/Makefile /tinygo/
39+
COPY --from=tinygo-base /tinygo/tools /tinygo/tools
40+
COPY --from=tinygo-base /tinygo/lib /tinygo/lib
4441

45-
RUN cd /go/src/github.com/tinygo-org/tinygo/ && \
42+
RUN cd /tinygo/ && \
4643
apt-get update && \
4744
apt-get install -y apt-utils python3 make binutils-avr gcc-avr avr-libc && \
4845
make gen-device-avr && \
@@ -54,13 +51,13 @@ RUN cd /go/src/github.com/tinygo-org/tinygo/ && \
5451
FROM tinygo-base AS tinygo-arm
5552

5653
COPY --from=tinygo-base /go/bin/tinygo /go/bin/tinygo
57-
COPY --from=tinygo-base /go/src/github.com/tinygo-org/tinygo/src /go/src/github.com/tinygo-org/tinygo/src
58-
COPY --from=tinygo-base /go/src/github.com/tinygo-org/tinygo/targets /go/src/github.com/tinygo-org/tinygo/targets
59-
COPY --from=tinygo-base /go/src/github.com/tinygo-org/tinygo/Makefile /go/src/github.com/tinygo-org/tinygo/
60-
COPY --from=tinygo-base /go/src/github.com/tinygo-org/tinygo/tools /go/src/github.com/tinygo-org/tinygo/tools
61-
COPY --from=tinygo-base /go/src/github.com/tinygo-org/tinygo/lib /go/src/github.com/tinygo-org/tinygo/lib
54+
COPY --from=tinygo-base /tinygo/src /tinygo/src
55+
COPY --from=tinygo-base /tinygo/targets /tinygo/targets
56+
COPY --from=tinygo-base /tinygo/Makefile /tinygo/
57+
COPY --from=tinygo-base /tinygo/tools /tinygo/tools
58+
COPY --from=tinygo-base /tinygo/lib /tinygo/lib
6259

63-
RUN cd /go/src/github.com/tinygo-org/tinygo/ && \
60+
RUN cd /tinygo/ && \
6461
apt-get update && \
6562
apt-get install -y apt-utils python3 make clang-8 && \
6663
make gen-device-nrf && make gen-device-stm32 && \
@@ -71,11 +68,11 @@ RUN cd /go/src/github.com/tinygo-org/tinygo/ && \
7168
# tinygo-all stage installs the needed dependencies to compile TinyGo programs for all platforms.
7269
FROM tinygo-wasm AS tinygo-all
7370

74-
COPY --from=tinygo-base /go/src/github.com/tinygo-org/tinygo/Makefile /go/src/github.com/tinygo-org/tinygo/
75-
COPY --from=tinygo-base /go/src/github.com/tinygo-org/tinygo/tools /go/src/github.com/tinygo-org/tinygo/tools
76-
COPY --from=tinygo-base /go/src/github.com/tinygo-org/tinygo/lib /go/src/github.com/tinygo-org/tinygo/lib
71+
COPY --from=tinygo-base /tinygo/Makefile /tinygo/
72+
COPY --from=tinygo-base /tinygo/tools /tinygo/tools
73+
COPY --from=tinygo-base /tinygo/lib /tinygo/lib
7774

78-
RUN cd /go/src/github.com/tinygo-org/tinygo/ && \
75+
RUN cd /tinygo/ && \
7976
apt-get update && \
8077
apt-get install -y apt-utils python3 make clang-8 binutils-avr gcc-avr avr-libc && \
8178
make gen-device && \

Gopkg.lock

Lines changed: 0 additions & 51 deletions
This file was deleted.

Gopkg.toml

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)