Add constants for commonly used values. (#3588)

This is a consolidation effort, avoiding usage
of naked strings in codebase. Whenever possible
use constants which can be repurposed elsewhere.

This also fixes `goconst ./...` reported issues.
This commit is contained in:
Harshavardhana
2017-01-18 12:24:34 -08:00
committed by GitHub
parent f803bb4b3d
commit 62f8343879
79 changed files with 461 additions and 462 deletions

View File

@@ -1,5 +1,5 @@
/*
* Minio Cloud Storage, (C) 2016 Minio, Inc.
* Minio Cloud Storage, (C) 2016, 2017 Minio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -79,7 +79,7 @@ func isSysErrTooLong(err error) bool {
// and ERROR_DIR_NOT_EMPTY for windows (directory not empty).
func isSysErrNotEmpty(err error) bool {
if pathErr, ok := err.(*os.PathError); ok {
if runtime.GOOS == "windows" {
if runtime.GOOS == globalWindowsOSName {
if errno, _ok := pathErr.Err.(syscall.Errno); _ok && errno == 0x91 {
// ERROR_DIR_NOT_EMPTY
return true
@@ -95,7 +95,7 @@ func isSysErrNotEmpty(err error) bool {
// Check if the given error corresponds to the specific ERROR_PATH_NOT_FOUND for windows
func isSysErrPathNotFound(err error) bool {
if runtime.GOOS != "windows" {
if runtime.GOOS != globalWindowsOSName {
return false
}
if pathErr, ok := err.(*os.PathError); ok {
@@ -109,7 +109,7 @@ func isSysErrPathNotFound(err error) bool {
// Check if the given error corresponds to the specific ERROR_INVALID_HANDLE for windows
func isSysErrHandleInvalid(err error) bool {
if runtime.GOOS != "windows" {
if runtime.GOOS != globalWindowsOSName {
return false
}
// Check if err contains ERROR_INVALID_HANDLE errno