Switch to using the dep tool and update all the dependencies

This commit is contained in:
Nick Craig-Wood
2017-05-11 15:39:54 +01:00
parent 5135ff73cb
commit 98c2d2c41b
5321 changed files with 4483197 additions and 5918 deletions
+6
View File
@@ -0,0 +1,6 @@
#!/bin/bash
today=$(date +%Y%m%d)
sed -i -r -e 's/const Repo = "([0-9]{8})"/const Repo = "'$today'"/' $GOFILE
+49
View File
@@ -0,0 +1,49 @@
// Copyright 2016 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//go:generate ./update_version.sh
// Package version contains version information for Google Cloud Client
// Libraries for Go, as reported in request headers.
package version
import (
"bytes"
"runtime"
"unicode"
)
// Repo is the current version of the client libraries in this
// repo. It should be a date in YYYYMMDD format.
const Repo = "20170210"
// Go returns the Go runtime version. The returned string
// has no whitespace.
func Go() string {
return goVersion
}
var goVersion = removeWhitespace(runtime.Version())
func removeWhitespace(s string) string {
var buf bytes.Buffer
for _, r := range s {
if unicode.IsSpace(r) {
buf.WriteByte('_')
} else {
buf.WriteRune(r)
}
}
return buf.String()
}
+47
View File
@@ -0,0 +1,47 @@
// Copyright 2016 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package version
import (
"regexp"
"testing"
)
func TestGo(t *testing.T) {
got := Go()
want := `^\S+$`
match, err := regexp.MatchString(want, got)
if err != nil {
t.Fatal(err)
}
if !match {
t.Errorf("got %q, want match of regexp %q", got, want)
}
}
func TestRemoveWhitespace(t *testing.T) {
for _, test := range []struct {
in, want string
}{
{"", ""},
{"go1.7", "go1.7"},
{" a b c ", "_a_b_c_"},
{"a\tb\t c\n", "a_b__c_"},
} {
if got := removeWhitespace(test.in); got != test.want {
t.Errorf("removeWhitespace(%q) = %q, want %q", test.in, got, test.want)
}
}
}