Skip to content
This repository was archived by the owner on May 24, 2022. It is now read-only.

Commit 4a43cfa

Browse files
committed
make deps
1 parent 2fbfda9 commit 4a43cfa

File tree

363 files changed

+56729
-636
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

363 files changed

+56729
-636
lines changed

Gopkg.lock

Lines changed: 151 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Gopkg.toml

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,3 @@
1-
# Gopkg.toml example
2-
#
3-
# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md
4-
# for detailed Gopkg.toml documentation.
5-
#
6-
# required = ["github.com/user/thing/cmd/thing"]
7-
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
8-
#
9-
# [[constraint]]
10-
# name = "github.com/user/project"
11-
# version = "1.0.0"
12-
#
13-
# [[constraint]]
14-
# name = "github.com/user/project2"
15-
# branch = "dev"
16-
# source = "github.com/myfork/project2"
17-
#
18-
# [[override]]
19-
# name = "github.com/x/y"
20-
# version = "2.4.0"
21-
#
22-
# [prune]
23-
# non-go = false
24-
# go-tests = true
25-
# unused-packages = true
26-
27-
281
[[constraint]]
292
branch = "develop"
303
name = "github.com/c3systems/c3-go"

Makefile

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,17 @@ test:
66

77
.PHONY: deps
88
deps:
9-
dep ensure -update -v
9+
dep ensure -update -v && \
10+
$(MAKE) gxundo
11+
12+
.PHONY: gxundo
13+
gxundo:
14+
@bash scripts/gxundo.sh vendor/
15+
16+
.PHONY: install/gxundo
17+
install/gxundo:
18+
@mkdir -p scripts && \
19+
wget https://raw.githubusercontent.com/c3systems/gxundo/master/gxundo.sh \
20+
-O scripts/gxundo.sh && \
21+
chmod +x scripts/gxundo.sh
22+

scripts/gxundo.sh

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
#!/bin/bash
2+
3+
#nc="\\033[0m"
4+
red="\\033[31m"
5+
green="\\033[32m"
6+
yellow="\\033[33m"
7+
#blue="\\033[34m"
8+
#purple="\\033[35m"
9+
cyan="\\033[36m"
10+
white="\\033[37m"
11+
bold="$(tput bold)"
12+
normal="$(tput sgr0)"
13+
14+
# function to install `jq`
15+
install_jq() {
16+
if [[ "$OSTYPE" == "linux-gnu" ]]; then
17+
sudo apt-get install jq
18+
elif [[ "$OSTYPE" == "darwin"* ]]; then
19+
brew install jq
20+
fi
21+
}
22+
23+
# check if `gorep` is installed, otherwise install it.
24+
command -v gorep >/dev/null
25+
exit_code=$?
26+
if [ "$exit_code" -ne 0 ]; then
27+
printf "$yellow%s$normal\\n" "gorep is not installed. Installing..."
28+
go get github.com/novalagung/gorep && printf "$green%s$normal\\n" "gorep installed"
29+
fi
30+
31+
# check if `jq` is installed, otherwise install it.
32+
command -v jq >/dev/null
33+
exit_code=$?
34+
if [ "$exit_code" -ne 0 ]; then
35+
printf "$yellow%s$normal\\n" "jq is not installed. Installing..."
36+
install_jq && printf "$green%s$normal\\n" "jq installed"
37+
fi
38+
39+
# the path to search passed an the only argument
40+
dirpath="$1"
41+
42+
if [[ "$dirpath" == "" ]]; then
43+
printf "$red$bold%s$normal\\n" "Error: path is required"
44+
exit 1
45+
fi
46+
47+
printf "$yellow%s$normal\\n" "finding imports recursively under $dirpath"
48+
49+
filter="sed -r 's|/[^/]+$||'"
50+
if [[ "$OSTYPE" == "darwin"* ]]; then
51+
filter="sed -E 's|/[^/]+$||'"
52+
fi
53+
54+
# read all Go imports that contain "gx/ipfs/"
55+
for dir in $(find "$dirpath" -maxdepth 100 -type f -name '*.go' | eval "$filter" | sort -u)
56+
do
57+
for line in $(go list -json "./$dir" | jq '.Imports' | grep 'gx/ipfs/' | sed -e 's/gx\///g' | sed -e 's/"//g' | sed -e 's/,//g' | sed -e 's/ //g')
58+
do
59+
# fetch the gx package.json and read the github url
60+
root="$(echo "$line" | tr "/" "\\n" | awk 'FNR <= 3 {print}' | tr '\n' '/' | sed -e s'/.$//g')"
61+
pkg="$(echo "$line" | tr "/" "\\n" | awk 'FNR > 3 {print}' | tr '\n' '/' | sed -e s'/.$//g')"
62+
jsonurl="https://gateway.ipfs.io/$root/package.json"
63+
printf "$white%s$normal\\n" "fetching $jsonurl"
64+
new="$(curl -s "$jsonurl" | jq '.gx.dvcsimport' | sed -e 's/"//g')"
65+
if [ "$pkg" != "" ]; then
66+
new="$new/$pkg"
67+
fi
68+
old="gx/$line"
69+
70+
printf "$cyan%s => %s$normal\\n" "$old" "$new"
71+
72+
# replace the imports
73+
gorep -path="$dir" \
74+
-from="$old" \
75+
-to="$new"
76+
77+
done
78+
done
79+
80+
printf "$green%s$normal\\n" "complete"
81+

sdk.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99

1010
log "github.com/sirupsen/logrus"
1111

12-
"github.com/c3systems/c3-go/common/hashing"
12+
"github.com/c3systems/c3-go/common/hashutil"
1313
"github.com/c3systems/c3-go/common/hexutil"
1414
"github.com/c3systems/c3-go/common/stringutil"
1515
c3config "github.com/c3systems/c3-go/config"
@@ -71,7 +71,7 @@ func NewC3() *C3 {
7171

7272
// RegisterMethod ...
7373
func (c3 *C3) RegisterMethod(methodName string, types []string, ifn interface{}) error {
74-
methodNameHash := hashing.HashToHexString([]byte(methodName))
74+
methodNameHash := hashutil.HashToHexString([]byte(methodName))
7575
if _, ok := c3.registeredMethods[methodNameHash]; ok {
7676
return ErrMethodAlreadyRegistered
7777
}
@@ -135,7 +135,7 @@ func (c3 *C3) RegisterMethod(methodName string, types []string, ifn interface{})
135135
func (c3 *C3) Serve() {
136136
server.NewServer(&server.Config{
137137
Host: c3config.ServerHost,
138-
Port: c3config.ServerPort,
138+
Port: c3config.DefaultServerPort,
139139
Receiver: c3.receiver,
140140
}).Run()
141141
}

vendor/github.com/BurntSushi/toml/.gitignore

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/BurntSushi/toml/.travis.yml

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/BurntSushi/toml/COMPATIBLE

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)