Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move to Go 1.5 #3863

Merged
merged 5 commits into from
Aug 27, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
## v0.9.4 [unreleased]

### Release Notes
With this release InfluxDB is moving to Go 1.5.

### Features
-[#3863](https://github.com/influxdb/influxdb/pull/3863): Move to Go 1.5

### Bugfixes
- [#3804](https://github.com/influxdb/influxdb/pull/3804): init.d script fixes, fixes issue 3803.
Expand Down
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,16 @@ second to sign our CLA, which can be found

Installing Go
-------------
InfluxDB requires Go 1.4 or greater.
InfluxDB requires Go 1.5 or greater.

At InfluxDB we find gvm, a Go version manager, useful for installing Go. For instructions
on how to install it see [the gvm page on github](https://github.com/moovweb/gvm).

After installing gvm you can install and set the default go version by
running the following:

gvm install go1.4
gvm use go1.4 --default
gvm install go1.5
gvm use go1.5 --default

Revision Control Systems
------
Expand Down Expand Up @@ -156,7 +156,7 @@ go install ./...
To set the version and commit flags during the build pass the following to the build command:

```bash
-ldflags="-X main.version $VERSION -X main.branch $BRANCH -X main.commit $COMMIT"
-ldflags="-X main.version $VERSION -X main.branch=$BRANCH -X main.commit=$COMMIT"
```

where `$VERSION` is the version, `$BRANCH` is the branch, and `$COMMIT` is the git commit hash.
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile_test_ubuntu32
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM 32bit/ubuntu:14.04

RUN apt-get update && apt-get install -y python-software-properties software-properties-common git
RUN add-apt-repository ppa:evarlast/golang1.4
RUN apt-get update && apt-get install -y golang-go
RUN add-apt-repository ppa:evarlast/golang1.5
RUN apt-get update && apt-get install -y -o Dpkg::Options::="--force-overwrite" golang-go

ENV GOPATH=/root/go
RUN mkdir -p /root/go/src/github.com/influxdb/influxdb
Expand Down
2 changes: 1 addition & 1 deletion circle-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# build process for InfluxDB.

BUILD_DIR=$HOME/influxdb-build
GO_VERSION=go1.4.2
GO_VERSION=go1.5
PARALLELISM="-parallel 256"
TIMEOUT="-timeout 480s"

Expand Down
2 changes: 1 addition & 1 deletion circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ machine:
- docker
pre:
- bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)
- source $HOME/.gvm/scripts/gvm; gvm install go1.4.2 --binary
- source $HOME/.gvm/scripts/gvm; gvm install go1.5 --binary

dependencies:
override:
Expand Down
36 changes: 27 additions & 9 deletions client/influxdb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -498,13 +498,12 @@ func TestBatchPoints_Normal(t *testing.T) {
}

func TestClient_Timeout(t *testing.T) {
done := make(chan bool)
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
time.Sleep(1 * time.Second)
var data client.Response
w.WriteHeader(http.StatusOK)
_ = json.NewEncoder(w).Encode(data)
<-done
}))
defer ts.Close()
defer func() { done <- true }()

u, _ := url.Parse(ts.URL)
config := client.Config{URL: *u, Timeout: 500 * time.Millisecond}
Expand All @@ -517,13 +516,32 @@ func TestClient_Timeout(t *testing.T) {
_, err = c.Query(query)
if err == nil {
t.Fatalf("unexpected success. expected timeout error")
} else if !strings.Contains(err.Error(), "use of closed network connection") {
t.Fatalf("unexpected error. expected 'use of closed network connection' error, got %v", err)
} else if !strings.Contains(err.Error(), "request canceled") {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@corylanou -- please confirm that this is OK with you. I think the error must have changed in Go 1.5.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's interesting. It appears to be a "better" error now. I don't remember reading anything in the release notes on it, but it's probably in their changelog. Seems fine. +1

t.Fatalf("unexpected error. expected 'request canceled' error, got %v", err)
}
}

confignotimeout := client.Config{URL: *u}
cnotimeout, err := client.NewClient(confignotimeout)
_, err = cnotimeout.Query(query)
func TestClient_NoTimeout(t *testing.T) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TestClientTimeout has been split into two tests.

if testing.Short() {
t.Skip("skipping in short mode")
}
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
time.Sleep(1 * time.Second)
var data client.Response
w.WriteHeader(http.StatusOK)
_ = json.NewEncoder(w).Encode(data)
}))
defer ts.Close()

u, _ := url.Parse(ts.URL)
config := client.Config{URL: *u}
c, err := client.NewClient(config)
if err != nil {
t.Fatalf("unexpected error. expected %v, actual %v", nil, err)
}

query := client.Query{}
_, err = c.Query(query)
if err != nil {
t.Fatalf("unexpected error. expected %v, actual %v", nil, err)
}
Expand Down
3 changes: 0 additions & 3 deletions cmd/influxd/run/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,6 @@ func (cmd *Command) Run(args ...string) error {
return fmt.Errorf("write pid file: %s", err)
}

// Set parallelism.
runtime.GOMAXPROCS(runtime.NumCPU())

// Turn on block profiling to debug stuck databases
runtime.SetBlockProfileRate(int(1 * time.Second))

Expand Down
4 changes: 2 additions & 2 deletions package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ if [ -z "$FPM" ]; then
FPM=`which fpm`
fi

GO_VERSION="go1.4.2"
GO_VERSION="go1.5"
GOPATH_INSTALL=
BINS=(
influxd
Expand Down Expand Up @@ -190,7 +190,7 @@ do_build() {
cleanup_exit 1
fi

go install -a -ldflags="-X main.version $version -X main.branch $branch -X main.commit $commit" ./...
go install -a -ldflags="-X main.version $version -X main.branch=$branch -X main.commit=$commit" ./...
if [ $? -ne 0 ]; then
echo "Build failed, unable to create package -- aborting"
cleanup_exit 1
Expand Down