Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
49553d4a
Commit
49553d4a
authored
Oct 17, 2017
by
Marcin Owsiany
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix lint warnings for useless err checks.
This check was recently added to golint.
parent
1d8f1e26
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
13 additions
and
53 deletions
+13
-53
apply.go
cmd/kubeadm/app/cmd/upgrade/apply.go
+2
-8
proxy.go
cmd/kubeadm/app/phases/addons/proxy/proxy.go
+2
-8
pki_helpers.go
cmd/kubeadm/app/phases/certs/pkiutil/pki_helpers.go
+1
-5
fsstore.go
pkg/kubelet/kubeletconfig/checkpoint/store/fsstore.go
+2
-8
configfiles_test.go
pkg/kubelet/kubeletconfig/configfiles/configfiles_test.go
+1
-4
controller.go
pkg/kubelet/kubeletconfig/controller.go
+1
-4
files.go
pkg/kubelet/kubeletconfig/util/files/files.go
+2
-8
io.go
staging/src/k8s.io/client-go/util/cert/io.go
+2
-8
No files found.
cmd/kubeadm/app/cmd/upgrade/apply.go
View file @
49553d4a
...
@@ -241,10 +241,7 @@ func PerformStaticPodUpgrade(client clientset.Interface, waiter apiclient.Waiter
...
@@ -241,10 +241,7 @@ func PerformStaticPodUpgrade(client clientset.Interface, waiter apiclient.Waiter
return
err
return
err
}
}
if
err
:=
upgrade
.
StaticPodControlPlane
(
waiter
,
pathManager
,
internalcfg
);
err
!=
nil
{
return
upgrade
.
StaticPodControlPlane
(
waiter
,
pathManager
,
internalcfg
)
return
err
}
return
nil
}
}
// DryRunStaticPodUpgrade fakes an upgrade of the control plane
// DryRunStaticPodUpgrade fakes an upgrade of the control plane
...
@@ -268,8 +265,5 @@ func DryRunStaticPodUpgrade(internalcfg *kubeadmapi.MasterConfiguration) error {
...
@@ -268,8 +265,5 @@ func DryRunStaticPodUpgrade(internalcfg *kubeadmapi.MasterConfiguration) error {
files
=
append
(
files
,
dryrunutil
.
NewFileToPrint
(
realPath
,
outputPath
))
files
=
append
(
files
,
dryrunutil
.
NewFileToPrint
(
realPath
,
outputPath
))
}
}
if
err
:=
dryrunutil
.
PrintDryRunFiles
(
files
,
os
.
Stdout
);
err
!=
nil
{
return
dryrunutil
.
PrintDryRunFiles
(
files
,
os
.
Stdout
)
return
err
}
return
nil
}
}
cmd/kubeadm/app/phases/addons/proxy/proxy.go
View file @
49553d4a
...
@@ -99,10 +99,7 @@ func CreateServiceAccount(client clientset.Interface) error {
...
@@ -99,10 +99,7 @@ func CreateServiceAccount(client clientset.Interface) error {
// CreateRBACRules creates the essential RBAC rules for a minimally set-up cluster
// CreateRBACRules creates the essential RBAC rules for a minimally set-up cluster
func
CreateRBACRules
(
client
clientset
.
Interface
)
error
{
func
CreateRBACRules
(
client
clientset
.
Interface
)
error
{
if
err
:=
createClusterRoleBindings
(
client
);
err
!=
nil
{
return
createClusterRoleBindings
(
client
)
return
err
}
return
nil
}
}
func
createKubeProxyAddon
(
configMapBytes
,
daemonSetbytes
[]
byte
,
client
clientset
.
Interface
)
error
{
func
createKubeProxyAddon
(
configMapBytes
,
daemonSetbytes
[]
byte
,
client
clientset
.
Interface
)
error
{
...
@@ -122,10 +119,7 @@ func createKubeProxyAddon(configMapBytes, daemonSetbytes []byte, client clientse
...
@@ -122,10 +119,7 @@ func createKubeProxyAddon(configMapBytes, daemonSetbytes []byte, client clientse
}
}
// Create the DaemonSet for kube-proxy or update it in case it already exists
// Create the DaemonSet for kube-proxy or update it in case it already exists
if
err
:=
apiclient
.
CreateOrUpdateDaemonSet
(
client
,
kubeproxyDaemonSet
);
err
!=
nil
{
return
apiclient
.
CreateOrUpdateDaemonSet
(
client
,
kubeproxyDaemonSet
)
return
err
}
return
nil
}
}
func
createClusterRoleBindings
(
client
clientset
.
Interface
)
error
{
func
createClusterRoleBindings
(
client
clientset
.
Interface
)
error
{
...
...
cmd/kubeadm/app/phases/certs/pkiutil/pki_helpers.go
View file @
49553d4a
...
@@ -76,11 +76,7 @@ func WriteCertAndKey(pkiPath string, name string, cert *x509.Certificate, key *r
...
@@ -76,11 +76,7 @@ func WriteCertAndKey(pkiPath string, name string, cert *x509.Certificate, key *r
return
err
return
err
}
}
if
err
:=
WriteCert
(
pkiPath
,
name
,
cert
);
err
!=
nil
{
return
WriteCert
(
pkiPath
,
name
,
cert
)
return
err
}
return
nil
}
}
// WriteCert stores the given certificate at the given location
// WriteCert stores the given certificate at the given location
...
...
pkg/kubelet/kubeletconfig/checkpoint/store/fsstore.go
View file @
49553d4a
...
@@ -56,10 +56,7 @@ func (s *fsStore) Initialize() error {
...
@@ -56,10 +56,7 @@ func (s *fsStore) Initialize() error {
if
err
:=
utilfiles
.
EnsureFile
(
s
.
fs
,
filepath
.
Join
(
s
.
checkpointsDir
,
curFile
));
err
!=
nil
{
if
err
:=
utilfiles
.
EnsureFile
(
s
.
fs
,
filepath
.
Join
(
s
.
checkpointsDir
,
curFile
));
err
!=
nil
{
return
err
return
err
}
}
if
err
:=
utilfiles
.
EnsureFile
(
s
.
fs
,
filepath
.
Join
(
s
.
checkpointsDir
,
lkgFile
));
err
!=
nil
{
return
utilfiles
.
EnsureFile
(
s
.
fs
,
filepath
.
Join
(
s
.
checkpointsDir
,
lkgFile
))
return
err
}
return
nil
}
}
func
(
s
*
fsStore
)
Exists
(
uid
string
)
(
bool
,
error
)
{
func
(
s
*
fsStore
)
Exists
(
uid
string
)
(
bool
,
error
)
{
...
@@ -77,10 +74,7 @@ func (s *fsStore) Save(c checkpoint.Checkpoint) error {
...
@@ -77,10 +74,7 @@ func (s *fsStore) Save(c checkpoint.Checkpoint) error {
return
err
return
err
}
}
// save the file
// save the file
if
err
:=
utilfiles
.
ReplaceFile
(
s
.
fs
,
filepath
.
Join
(
s
.
checkpointsDir
,
c
.
UID
()),
data
);
err
!=
nil
{
return
utilfiles
.
ReplaceFile
(
s
.
fs
,
filepath
.
Join
(
s
.
checkpointsDir
,
c
.
UID
()),
data
)
return
err
}
return
nil
}
}
func
(
s
*
fsStore
)
Load
(
uid
string
)
(
checkpoint
.
Checkpoint
,
error
)
{
func
(
s
*
fsStore
)
Load
(
uid
string
)
(
checkpoint
.
Checkpoint
,
error
)
{
...
...
pkg/kubelet/kubeletconfig/configfiles/configfiles_test.go
View file @
49553d4a
...
@@ -37,10 +37,7 @@ func addFile(fs utilfs.Filesystem, path string, file string) error {
...
@@ -37,10 +37,7 @@ func addFile(fs utilfs.Filesystem, path string, file string) error {
if
err
:=
utilfiles
.
EnsureDir
(
fs
,
filepath
.
Dir
(
path
));
err
!=
nil
{
if
err
:=
utilfiles
.
EnsureDir
(
fs
,
filepath
.
Dir
(
path
));
err
!=
nil
{
return
err
return
err
}
}
if
err
:=
utilfiles
.
ReplaceFile
(
fs
,
path
,
[]
byte
(
file
));
err
!=
nil
{
return
utilfiles
.
ReplaceFile
(
fs
,
path
,
[]
byte
(
file
))
return
err
}
return
nil
}
}
func
TestLoad
(
t
*
testing
.
T
)
{
func
TestLoad
(
t
*
testing
.
T
)
{
...
...
pkg/kubelet/kubeletconfig/controller.go
View file @
49553d4a
...
@@ -248,10 +248,7 @@ func (cc *Controller) StartSync(client clientset.Interface, nodeName string) {
...
@@ -248,10 +248,7 @@ func (cc *Controller) StartSync(client clientset.Interface, nodeName string) {
func
(
cc
*
Controller
)
initialize
()
error
{
func
(
cc
*
Controller
)
initialize
()
error
{
utillog
.
Infof
(
"ensuring filesystem is set up correctly"
)
utillog
.
Infof
(
"ensuring filesystem is set up correctly"
)
// initialize local checkpoint storage location
// initialize local checkpoint storage location
if
err
:=
cc
.
checkpointStore
.
Initialize
();
err
!=
nil
{
return
cc
.
checkpointStore
.
Initialize
()
return
err
}
return
nil
}
}
// localConfig returns the initConfig if it is loaded, otherwise returns the defaultConfig.
// localConfig returns the initConfig if it is loaded, otherwise returns the defaultConfig.
...
...
pkg/kubelet/kubeletconfig/util/files/files.go
View file @
49553d4a
...
@@ -109,10 +109,7 @@ func ReplaceFile(fs utilfs.Filesystem, path string, data []byte) error {
...
@@ -109,10 +109,7 @@ func ReplaceFile(fs utilfs.Filesystem, path string, data []byte) error {
return
err
return
err
}
}
// rename over existing file
// rename over existing file
if
err
:=
fs
.
Rename
(
tmpPath
,
path
);
err
!=
nil
{
return
fs
.
Rename
(
tmpPath
,
path
)
return
err
}
return
nil
}
}
// DirExists returns true if a directory exists at `path`, false if `path` does not exist, otherwise an error
// DirExists returns true if a directory exists at `path`, false if `path` does not exist, otherwise an error
...
@@ -138,8 +135,5 @@ func EnsureDir(fs utilfs.Filesystem, path string) error {
...
@@ -138,8 +135,5 @@ func EnsureDir(fs utilfs.Filesystem, path string) error {
}
// Assert: dir does not exist
}
// Assert: dir does not exist
// create the dir
// create the dir
if
err
:=
fs
.
MkdirAll
(
path
,
defaultPerm
);
err
!=
nil
{
return
fs
.
MkdirAll
(
path
,
defaultPerm
)
return
err
}
return
nil
}
}
staging/src/k8s.io/client-go/util/cert/io.go
View file @
49553d4a
...
@@ -66,10 +66,7 @@ func WriteCert(certPath string, data []byte) error {
...
@@ -66,10 +66,7 @@ func WriteCert(certPath string, data []byte) error {
if
err
:=
os
.
MkdirAll
(
filepath
.
Dir
(
certPath
),
os
.
FileMode
(
0755
));
err
!=
nil
{
if
err
:=
os
.
MkdirAll
(
filepath
.
Dir
(
certPath
),
os
.
FileMode
(
0755
));
err
!=
nil
{
return
err
return
err
}
}
if
err
:=
ioutil
.
WriteFile
(
certPath
,
data
,
os
.
FileMode
(
0644
));
err
!=
nil
{
return
ioutil
.
WriteFile
(
certPath
,
data
,
os
.
FileMode
(
0644
))
return
err
}
return
nil
}
}
// WriteKey writes the pem-encoded key data to keyPath.
// WriteKey writes the pem-encoded key data to keyPath.
...
@@ -80,10 +77,7 @@ func WriteKey(keyPath string, data []byte) error {
...
@@ -80,10 +77,7 @@ func WriteKey(keyPath string, data []byte) error {
if
err
:=
os
.
MkdirAll
(
filepath
.
Dir
(
keyPath
),
os
.
FileMode
(
0755
));
err
!=
nil
{
if
err
:=
os
.
MkdirAll
(
filepath
.
Dir
(
keyPath
),
os
.
FileMode
(
0755
));
err
!=
nil
{
return
err
return
err
}
}
if
err
:=
ioutil
.
WriteFile
(
keyPath
,
data
,
os
.
FileMode
(
0600
));
err
!=
nil
{
return
ioutil
.
WriteFile
(
keyPath
,
data
,
os
.
FileMode
(
0600
))
return
err
}
return
nil
}
}
// LoadOrGenerateKeyFile looks for a key in the file at the given path. If it
// LoadOrGenerateKeyFile looks for a key in the file at the given path. If it
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment