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
master
Harshavardhana 9 years ago
parent 04424ae9c2
commit 408aa72146
  1. 1
      .gitignore
  2. 2
      .travis.yml
  3. 12
      INSTALLGO.md
  4. 16
      Makefile
  5. 5
      appveyor.yml
  6. 3
      buildscripts/checkdeps.sh
  7. 40
      buildscripts/checkgopath.sh
  8. 2
      globals.go
  9. 4
      pkg/atomic/atomic.go
  10. 14
      pkg/erasure/INSTALLGO.md
  11. 4
      pkg/fs/fs.go
  12. 2
      pkg/ioutils/filepath.go
  13. 2
      pkg/xl/cache/data/data.go

1
.gitignore vendored

@ -13,3 +13,4 @@ build
isa-l
vendor/**/*.js
vendor/**/*.json
release

@ -27,7 +27,7 @@ script:
- make test GOFLAGS="-race"
go:
- 1.5.3
- 1.6
notifications:
slack:

@ -7,15 +7,15 @@ This installation document assumes Ubuntu 14.04+ on x86-64 platform.
$ sudo apt-get install git build-essential
```
##### Install Go 1.5+
##### Install Go 1.6+
Download Go 1.5+ 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
```
##### Source the new enviornment
@ -71,7 +71,7 @@ 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
```
##### Source the new enviornment
```sh

@ -1,5 +1,7 @@
LDFLAGS := $(shell go run buildscripts/gen-ldflags.go)
DOCKER_BIN := $(shell which docker)
PWD := $(shell pwd)
GOPATH := $(shell go env GOPATH)
DOCKER_LDFLAGS := '$(LDFLAGS) -extldflags "-static"'
BUILD_LDFLAGS := '$(LDFLAGS)'
TAG := latest
@ -47,20 +49,16 @@ endif
all: install
checkdeps:
checks:
@echo "Checking deps:"
@(env bash $(PWD)/buildscripts/checkdeps.sh)
checkgopath:
@echo "Checking if project is at ${GOPATH}"
@for miniopath in $(echo ${GOPATH} | sed 's/:/\n/g'); do if [ ! -d ${miniopath}/src/github.com/minio/minio ]; then echo "Project not found in ${miniopath}, please follow instructions provided at https://github.com/minio/minio/blob/master/CONTRIBUTING.md#setup-your-minio-github-repository" && exit 1; fi done
@echo "Setting BUILD_LDFLAGS: ${BUILD_LDFLAGS}"
@(env bash $(PWD)/buildscripts/checkgopath.sh)
checkdocker:
@echo "Checking if docker is installed.. "
@if [ -z ${DOCKER_BIN} ]; then echo "Docker not installed, cannot build docker image. Please install 'sudo apt-get install docker.io'" && exit 1; else echo "Docker installed at ${DOCKER_BIN}."; fi;
getdeps: checkdeps checkgopath
getdeps: checks
@go get -u github.com/golang/lint/golint && echo "Installed golint:"
@go get -u golang.org/x/tools/cmd/vet && echo "Installed vet:"
@go get -u github.com/fzipp/gocyclo && echo "Installed gocyclo:"
@ -110,8 +108,8 @@ spelling:
test: build
@echo "Running all minio testing:"
@CGO_CPPFLAGS="-I$(PWD)/isa-l" CGO_LDFLAGS="$(PWD)/isa-l/isa-l.a" GO15VENDOREXPERIMENT=1 go test $(GOFLAGS) .
@CGO_CPPFLAGS="-I$(PWD)/isa-l" CGO_LDFLAGS="$(PWD)/isa-l/isa-l.a" GO15VENDOREXPERIMENT=1 go test $(GOFLAGS) github.com/minio/minio/pkg...
@GODEBUG=cgocheck=0 CGO_CPPFLAGS="-I$(PWD)/isa-l" CGO_LDFLAGS="$(PWD)/isa-l/isa-l.a" GO15VENDOREXPERIMENT=1 go test $(GOFLAGS) .
@GODEBUG=cgocheck=0 CGO_CPPFLAGS="-I$(PWD)/isa-l" CGO_LDFLAGS="$(PWD)/isa-l/isa-l.a" GO15VENDOREXPERIMENT=1 go test $(GOFLAGS) github.com/minio/minio/pkg...
gomake-all: build
@echo "Installing minio:"

@ -10,12 +10,17 @@ environment:
GOPATH: c:\gopath
GO_EXTLINK_ENABLED: 0
GO15VENDOREXPERIMENT: 1
# Remove this after fixing erasure code.
GODEBUG: cgocheck=0
# scripts that run after cloning repository
install:
- '"C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64'
- curl -fsSL -o c:\go\bin\yasm.exe http://www.tortall.net/projects/yasm/releases/yasm-1.3.0-win64.exe
- set PATH=%GOPATH%\bin;c:\go\bin;%PATH%
- rd C:\Go /s /q
- appveyor DownloadFile https://storage.googleapis.com/golang/go1.6.windows-amd64.zip
- 7z x go1.6.windows-amd64.zip -oC:\ >nul
- curl -fsSL -o mingw-w64.7z http://downloads.sourceforge.net/project/mingw-w64-dgn/mingw-w64/mingw-w64-bin-x86_64-20151206.7z
- 7z x -oC:\ mingw-w64.7z > NUL
- set PATH=C:\mingw64\bin;%PATH%

@ -22,8 +22,7 @@ _init() {
## Minimum required versions for build dependencies
GIT_VERSION="1.0"
YASM_VERSION="1.2.0"
CURL_VERSION="7.12.0"
GO_VERSION="1.5.1"
GO_VERSION="1.6"
OSX_VERSION="10.8"
UNAME=$(uname -sm)

@ -0,0 +1,40 @@
#!/usr/bin/env bash
#
# Minio Cloud Storage, (C) 2015, 2016 Minio, Inc.
#
# 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.
#
_init() {
shopt -s extglob
PWD=$(pwd)
GOPATH=$(go env GOPATH)
}
main() {
echo "Checking if project is at ${GOPATH}"
for minio in $(echo ${GOPATH} | tr ':' ' '); do
if [ ! -d ${minio}/src/github.com/minio/minio ]; then
echo "Project not found in ${minio}, please follow instructions provided at https://github.com/minio/minio/blob/master/CONTRIBUTING.md#setup-your-minio-github-repository" \
&& exit 1
fi
if [ "x${minio}/src/github.com/minio/minio" != "x${PWD}" ]; then
echo "Build outside of ${minio}, two source checkouts found. Exiting." && exit 1
fi
done
}
_init && main

@ -18,5 +18,5 @@ package main
// Global constants for Minio.
const (
minGoVersion = ">= 1.5.1" // Minio requires at least Go v1.5.1
minGoVersion = ">= 1.6" // Minio requires at least Go v1.6
)

@ -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

@ -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
```

@ -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 {

@ -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 {

@ -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

Loading…
Cancel
Save