Skip to content

Commit 9e18b78

Browse files
authored
Merge pull request #2 from redsift/convert_to_modules
convert to mods
2 parents 003e51e + aa20b29 commit 9e18b78

File tree

15 files changed

+78
-231
lines changed

15 files changed

+78
-231
lines changed

.circleci/config.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ version: 2.1
22

33
default:
44
environment: &envvars
5-
RPC_REPO: github.com/redsift/go-sandbox-rpc
6-
RPC_REPO_COMMIT: e56484a
75
CONTAINER_NAME: quay.io/redsift/sandbox-go
86
CIRCLE_REVERSE_DEPENDENCIES: sandbox-go-rocksdb
97
executors:
@@ -37,7 +35,7 @@ jobs:
3735
executor: dockexec
3836
steps:
3937
- v_build:
40-
nv: "1.15.3"
38+
nv: "1.15.4"
4139

4240
trigger-builds:
4341
executor: dockexec

Dockerfile

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM quay.io/redsift/sandbox:latest
2-
LABEL author="Christos Vontas"
3-
LABEL email="christos@redsift.io"
4-
LABEL version="1.0.2"
2+
LABEL author="Anon Cohen"
3+
LABEL email="amnon.cohen@redsift.io"
4+
LABEL version="1.1.0"
55

66
RUN export DEBIAN_FRONTEND=noninteractive && \
77
apt-get update && \
@@ -10,8 +10,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
1010

1111
LABEL io.redsift.sandbox.install="/usr/bin/redsift/install" io.redsift.sandbox.run="/usr/bin/redsift/run"
1212

13-
ARG golang_version=1.10.8
14-
ENV GODEP_V=v0.5.0
13+
ARG golang_version=1.15.4
1514

1615
RUN set -eux; \
1716
url="https://golang.org/dl/go${golang_version}.linux-amd64.tar.gz"; \
@@ -22,25 +21,19 @@ RUN set -eux; \
2221
go version
2322

2423
COPY root /
25-
COPY go-wrapper /usr/local/bin/
26-
27-
ENV RPC_REPO github.com/redsift/go-sandbox-rpc
2824

2925
ENV GOPATH /usr/lib/redsift/workspace
3026
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
3127
ENV SANDBOX_PATH $GOPATH/src/github.com/redsift/sandbox-go
28+
ENV GO111MODULE on
3229

3330
COPY cmd $SANDBOX_PATH/cmd
3431
COPY sandbox $SANDBOX_PATH/sandbox
35-
COPY Gopkg.* $SANDBOX_PATH/
32+
COPY go.* $SANDBOX_PATH/
3633

3734
WORKDIR $SANDBOX_PATH
3835

39-
RUN wget -O /usr/local/bin/dep "https://github.com/golang/dep/releases/download/${GODEP_V}/dep-linux-amd64" && \
40-
chmod +x /usr/local/bin/dep && \
41-
ln -s /run/sandbox/sift/server $GOPATH/src/server && \
42-
dep ensure -v && dep status && \
43-
rm -rf vendor/$RPC_REPO && \
36+
RUN \
4437
go build -o /usr/bin/redsift/go_install cmd/install/install.go && \
4538
chmod +x /usr/bin/redsift/go_install && \
4639
chown -R sandbox:sandbox $GOPATH

Gopkg.lock

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

Gopkg.toml

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

circle/docker_build

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,6 @@ if [ $tagName == "release" ]; then
1414
fi
1515
imageName=$CONTAINER_NAME:v$GV$SUFFIX
1616

17-
LOCAL_RPC_REPO="root/usr/lib/redsift/workspace/src/${RPC_REPO}"
18-
git clone "git@${RPC_REPO/com\//com:}" $LOCAL_RPC_REPO
19-
pushd $LOCAL_RPC_REPO
20-
git checkout $RPC_REPO_COMMIT
21-
popd
22-
2317
echo "Configuring FROM and ENTRYPOINT in Dockerfile with base=sandbox:${parentVersion}"
2418
sed "s/^\(FROM quay.io\/redsift\/sandbox:\).*$/\1${parentVersion}/" < Dockerfile > Dockerfile.versioned
2519

cmd/install/install.go

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package main
22

33
import (
4-
"fmt"
4+
"log"
55
"os"
66
"os/exec"
77
"path"
@@ -28,23 +28,23 @@ var Computes = map[int]func(sandboxrpc.ComputeRequest) ([]sandboxrpc.ComputeResp
2828
func main() {
2929
info, err := sandbox.NewInit(os.Args[1:])
3030
if err != nil {
31-
die("%s", err.Error())
31+
log.Fatal(err)
3232
}
3333

3434
uniquePaths := map[string]int{}
3535
nodeNames := map[int]string{}
3636
for _, i := range info.Nodes {
3737
node := info.Sift.Dag.Nodes[i]
3838
if node.Implementation == nil || len(node.Implementation.Go) == 0 {
39-
die("Requested to install a non-Go node at index %d\n", i)
39+
log.Fatalf("Requested to install a non-Go node at index %d", i)
4040
}
4141

4242
implPath := node.Implementation.Go
43-
fmt.Printf("Installing node: %s : %s\n", node.Description, implPath)
43+
log.Printf("Installing node: %s : %s\n", node.Description, implPath)
4444

4545
// absolutePath := path.Join(i.SIFT_ROOT, node.Implementation.Go)
4646
if _, err := os.Stat(path.Join(info.SIFT_ROOT, implPath)); os.IsNotExist(err) {
47-
die("Implementation at index %d : %s does not exist!\n", i, implPath)
47+
log.Fatalf("Implementation at index %d : %s does not exist!", i, implPath)
4848
}
4949

5050
packageName := path.Base(implPath)
@@ -63,22 +63,22 @@ func main() {
6363

6464
fo, err := os.Create(SIFT_GO_LOCATION)
6565
if err != nil {
66-
die("%s", err.Error())
66+
log.Fatal(err)
6767
}
6868
defer func() {
6969
if err := fo.Close(); err != nil {
70-
die("%s", err.Error())
70+
log.Fatal(err)
7171
}
7272
}()
7373

7474
t := template.New("sift.go")
7575
t, _ = t.Parse(sift_temp)
7676
err = t.Execute(fo, struct {
77-
Paths []string
77+
Paths []string
7878
NodeNames map[int]string
7979
}{paths, nodeNames})
8080
if err != nil {
81-
die("Failed to generate sift.go: %s", err.Error())
81+
log.Fatalf("Failed to generate sift.go: %s", err.Error())
8282
}
8383

8484
//
@@ -91,13 +91,8 @@ func main() {
9191
buildArgs = append(buildArgs, "-v", "-o", "/run/sandbox/sift/server/_run", path.Join(PROJECT_LOCATION, "cmd/run/run.go"))
9292
bcmd := exec.Command("go", buildArgs...)
9393
bstdoutStderr, err := bcmd.CombinedOutput()
94-
fmt.Printf("%s\n", bstdoutStderr)
94+
log.Printf("%s\n", bstdoutStderr)
9595
if err != nil {
96-
die("Building sandbox failed: %s", err)
96+
log.Fatalf("Building sandbox failed: %s", err)
9797
}
9898
}
99-
100-
func die(format string, v ...interface{}) {
101-
fmt.Fprintln(os.Stderr, fmt.Sprintf(format, v...))
102-
os.Exit(1)
103-
}

cmd/run/run_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package main
33
import (
44
"encoding/json"
55
"fmt"
6+
"log"
67
"os"
78
"os/exec"
89
"testing"
@@ -40,7 +41,10 @@ func TestComputeRequest(t *testing.T) {
4041
func TestMain(m *testing.M) {
4142
go func() {
4243
cmd := exec.Command("/usr/bin/redsift/run", "1")
43-
stdoutStderr, _ := cmd.CombinedOutput()
44+
stdoutStderr, err := cmd.CombinedOutput()
45+
if err != nil {
46+
log.Fatalln(err)
47+
}
4448
fmt.Printf("%s\n", stdoutStderr)
4549
}()
4650
os.Exit(m.Run())

go-wrapper

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

go.mod

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module github.com/redsift/sandbox-go
2+
3+
go 1.15
4+
5+
require (
6+
github.com/redsift/go-mangosock v0.2.0
7+
github.com/redsift/go-sandbox-rpc v0.1.0
8+
)
9+
10+
replace server => /run/sandbox/sift/server

go.sum

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
github.com/Microsoft/go-winio v0.4.15 h1:qkLXKzb1QoVatRyd/YlXZ/Kg0m5K3SPuoD82jjSOaBc=
2+
github.com/Microsoft/go-winio v0.4.15/go.mod h1:tTuCMEN+UleMWgg9dVx4Hu52b1bJo+59jBh3ajtinzw=
3+
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
4+
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8=
5+
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
6+
github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc=
7+
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
8+
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
9+
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
10+
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
11+
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
12+
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
13+
github.com/redsift/go-mangosock v0.2.0 h1:xyKrA77Mgb8n2NuZkgOpm5YnX65cpD+uvr+AHqN6DDA=
14+
github.com/redsift/go-mangosock v0.2.0/go.mod h1:e31gqueU2A91oRF8yla05/XK6yxoKCkUIcw7ZO+DrEo=
15+
github.com/redsift/go-sandbox-rpc v0.1.0 h1:RAMxFMK7XE7qD8KJd6n2Pl5Mof4+9IA9UAe9eiMx8oU=
16+
github.com/redsift/go-sandbox-rpc v0.1.0/go.mod h1:57m4ei6UvUwdB8jFxy5QWDLhIgYngPfI+dIRnoPndUI=
17+
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
18+
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=
19+
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
20+
github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s=
21+
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
22+
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
23+
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
24+
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
25+
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
26+
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
27+
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
28+
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3 h1:7TYNF4UdlohbFwpNH04CoPMp1cHUZgO1Ebq5r2hIjfo=
29+
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
30+
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
31+
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
32+
nanomsg.org/go-mangos v1.4.0 h1:pVRLnzXePdSbhWlWdSncYszTagERhMG5zK/vXYmbEdM=
33+
nanomsg.org/go-mangos v1.4.0/go.mod h1:MOor8xUIgwsRMPpLr9xQxe7bT7rciibScOqVyztNxHQ=

0 commit comments

Comments
 (0)