build/vet: Fix all the shadowing reports with go1.6

Golang 1.6 is default version for the build now.

Additionally set 'GODEBUG=cgocheck=0' for now, until
we fix the erasure coding package.

Readmore here https://tip.golang.org/doc/go1.6#cgo
This commit is contained in:
Harshavardhana
2016-02-18 17:16:41 -08:00
parent 04424ae9c2
commit 408aa72146
13 changed files with 77 additions and 34 deletions

View File

@@ -85,8 +85,8 @@ func FileCreateWithPrefix(filePath string, prefix string) (*File, error) {
if err != nil {
return nil, err
}
if err := os.Chmod(f.Name(), 0600); err != nil {
if err := os.Remove(f.Name()); err != nil {
if err = os.Chmod(f.Name(), 0600); err != nil {
if err = os.Remove(f.Name()); err != nil {
return nil, err
}
return nil, err

View File

@@ -7,15 +7,15 @@ This installation document assumes Ubuntu 14.04+ on x86-64 platform.
$ sudo apt-get install git build-essential yasm
```
##### Install Go 1.5.1+
##### Install Go 1.6+
Download Go 1.5.1+ from [https://golang.org/dl/](https://golang.org/dl/).
Download Go 1.6+ from [https://golang.org/dl/](https://golang.org/dl/).
```sh
$ wget https://storage.googleapis.com/golang/go1.5.1.linux-amd64.tar.gz
$ wget https://storage.googleapis.com/golang/go1.6.linux-amd64.tar.gz
$ mkdir -p ${HOME}/bin/
$ mkdir -p ${HOME}/go/
$ tar -C ${HOME}/bin/ -xzf go1.5.1.linux-amd64.tar.gz
$ tar -C ${HOME}/bin/ -xzf go1.6.linux-amd64.tar.gz
```
##### Setup GOROOT and GOPATH
@@ -25,7 +25,7 @@ and GOPATH specifies the location of your project workspace.
```sh
$ export GOROOT=${HOME}/bin/go
$ export GOPATH=${HOME}/go
$ export PATH=$PATH:${HOME}/bin/go/bin:${GOPATH}/bin
$ export PATH=${HOME}/bin/go/bin:${GOPATH}/bin:$PATH
```
## OS X (Yosemite) 10.10
@@ -42,7 +42,7 @@ $ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/maste
$ brew install git python yasm
```
##### Install Go 1.5.1+
##### Install Go 1.6+
Install golang binaries using `brew`
@@ -60,5 +60,5 @@ and GOPATH specifies the location of your project workspace.
$ export GOPATH=${HOME}/go
$ export GOVERSION=$(brew list go | head -n 1 | cut -d '/' -f 6)
$ export GOROOT=$(brew --prefix)/Cellar/go/${GOVERSION}/libexec
$ export PATH=$PATH:${GOPATH}/bin
$ export PATH=${GOPATH}/bin:$PATH
```

View File

@@ -72,7 +72,7 @@ func New(rootPath string, minFreeDisk int64) (Filesystem, *probe.Error) {
Version: "1",
ActiveSession: make(map[string]*MultipartSession),
}
if err := saveMultipartsSession(*multiparts); err != nil {
if err = saveMultipartsSession(*multiparts); err != nil {
return Filesystem{}, err.Trace()
}
} else {
@@ -88,7 +88,7 @@ func New(rootPath string, minFreeDisk int64) (Filesystem, *probe.Error) {
Version: "1",
Metadata: make(map[string]*BucketMetadata),
}
if err := saveBucketsMetadata(*buckets); err != nil {
if err = saveBucketsMetadata(*buckets); err != nil {
return Filesystem{}, err.Trace()
}
} else {

View File

@@ -126,7 +126,7 @@ func walk(path string, info os.FileInfo, walkFn FTWFunc) error {
for _, fileInfo := range fis {
filename := filepath.Join(path, fileInfo.Name())
if err != nil {
if err := walkFn(filename, fileInfo, err); err != nil && err != ErrSkipDir && err != ErrSkipFile {
if err = walkFn(filename, fileInfo, err); err != nil && err != ErrSkipDir && err != ErrSkipFile {
return err
}
} else {

View File

@@ -135,7 +135,7 @@ func (r *Cache) Append(key interface{}, value []byte) bool {
}
ele, hit := r.reverseItems[key]
if !hit {
ele := r.items.PushFront(&element{key, value})
ele = r.items.PushFront(&element{key, value})
r.currentSize += valueLen
r.reverseItems[key] = ele
return true