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
950f5a27
Commit
950f5a27
authored
Aug 12, 2014
by
roberthbailey
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #873 from lavalamp/fix
Fix gofmt/boilerplate verification scripts and associated files.
parents
4b05cb0e
ab24790e
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
38 additions
and
25 deletions
+38
-25
pause.go
build/pause/pause.go
+16
-0
verify-boilerplate.sh
hack/verify-boilerplate.sh
+7
-10
verify-gofmt.sh
hack/verify-gofmt.sh
+4
-2
validation.go
pkg/api/validation.go
+1
-1
validation_test.go
pkg/api/validation_test.go
+1
-1
minionproxy_test.go
pkg/apiserver/minionproxy_test.go
+1
-1
file.go
pkg/kubelet/config/file.go
+1
-1
file_test.go
pkg/kubelet/config/file_test.go
+3
-5
http.go
pkg/kubelet/config/http.go
+1
-1
server_test.go
pkg/kubelet/server_test.go
+2
-2
config.go
pkg/util/config/config.go
+1
-1
No files found.
build/pause/pause.go
View file @
950f5a27
/*
Copyright 2014 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
main
package
main
import
"syscall"
import
"syscall"
...
...
hack/verify-boilerplate.sh
View file @
950f5a27
...
@@ -14,19 +14,16 @@
...
@@ -14,19 +14,16 @@
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
REPO_ROOT
=
"
$(
realpath
"
$(
dirname
$0
)
/.."
)
"
REPO_ROOT
=
"
$(
cd
"
$(
dirname
"
$0
"
)
/../"
&&
pwd
-P
)
"
result
=
0
result
=
0
dirs
=(
"pkg"
"cmd"
)
gofiles
=
"
$(
find
${
REPO_ROOT
}
-type
f |
grep
"[.]go$"
|
grep
-v
"third_party/
\|
release/
\|
output/
\|
target/"
)
"
for
file
in
${
gofiles
}
;
do
for
dir
in
${
dirs
[@]
}
;
do
if
[[
"
$(${
REPO_ROOT
}
/hooks/boilerplate.sh
"
${
file
}
"
)
"
-eq
"0"
]]
;
then
for
file
in
$(
grep
-r
-l
""
"
${
REPO_ROOT
}
/
${
dir
}
/"
|
grep
"[.]go"
)
;
do
echo
"Boilerplate header is wrong for:
${
file
}
"
if
[[
"
$(${
REPO_ROOT
}
/hooks/boilerplate.sh
"
${
file
}
"
)
"
-eq
"0"
]]
;
then
result
=
1
echo
"Boilerplate header is wrong for:
${
file
}
"
fi
result
=
1
fi
done
done
done
dirs
=(
"cluster"
"hack"
"hooks"
)
dirs
=(
"cluster"
"hack"
"hooks"
)
...
...
hack/verify-gofmt.sh
View file @
950f5a27
...
@@ -24,9 +24,11 @@ if [[ ${GO_VERSION[2]} != "go1.2" && ${GO_VERSION[2]} != "go1.3" ]]; then
...
@@ -24,9 +24,11 @@ if [[ ${GO_VERSION[2]} != "go1.2" && ${GO_VERSION[2]} != "go1.3" ]]; then
exit
0
exit
0
fi
fi
REPO_ROOT
=
"
$(
cd
"
$(
dirname
"
$0
"
)
/../"
&&
pwd
-P
)
"
bad
=
$(
gofmt
-s
-l
pkg/ cmd/
)
files
=
"
$(
find
${
REPO_ROOT
}
-type
f |
grep
"[.]go$"
|
grep
-v
"third_party/
\|
release/
\|
output/
\|
target/"
)
"
if
[
"
$?
"
!=
"0"
]
;
then
bad
=
$(
gofmt
-s
-l
${
files
})
if
[[
-n
"
${
bad
}
"
]]
;
then
echo
"
$bad
"
echo
"
$bad
"
exit
1
exit
1
fi
fi
pkg/api/validation.go
View file @
950f5a27
...
@@ -321,7 +321,7 @@ func ValidateReplicationController(controller *ReplicationController) []error {
...
@@ -321,7 +321,7 @@ func ValidateReplicationController(controller *ReplicationController) []error {
errors
=
append
(
errors
,
makeInvalidError
(
"ReplicationController.ReplicaSelector"
,
controller
.
DesiredState
.
ReplicaSelector
))
errors
=
append
(
errors
,
makeInvalidError
(
"ReplicationController.ReplicaSelector"
,
controller
.
DesiredState
.
ReplicaSelector
))
}
}
if
controller
.
DesiredState
.
Replicas
<
0
{
if
controller
.
DesiredState
.
Replicas
<
0
{
errors
=
append
(
errors
,
makeInvalidError
(
"ReplicationController.Replicas"
,
controller
.
DesiredState
.
Replicas
))
errors
=
append
(
errors
,
makeInvalidError
(
"ReplicationController.Replicas"
,
controller
.
DesiredState
.
Replicas
))
}
}
errors
=
append
(
errors
,
ValidateManifest
(
&
controller
.
DesiredState
.
PodTemplate
.
DesiredState
.
Manifest
)
...
)
errors
=
append
(
errors
,
ValidateManifest
(
&
controller
.
DesiredState
.
PodTemplate
.
DesiredState
.
Manifest
)
...
)
return
errors
return
errors
...
...
pkg/api/validation_test.go
View file @
950f5a27
...
@@ -420,7 +420,7 @@ func TestValidateReplicationController(t *testing.T) {
...
@@ -420,7 +420,7 @@ func TestValidateReplicationController(t *testing.T) {
"negative_replicas"
:
{
"negative_replicas"
:
{
JSONBase
:
JSONBase
{
ID
:
"abc"
},
JSONBase
:
JSONBase
{
ID
:
"abc"
},
DesiredState
:
ReplicationControllerState
{
DesiredState
:
ReplicationControllerState
{
Replicas
:
-
1
,
Replicas
:
-
1
,
ReplicaSelector
:
validSelector
,
ReplicaSelector
:
validSelector
,
},
},
},
},
...
...
pkg/apiserver/minionproxy_test.go
View file @
950f5a27
...
@@ -111,7 +111,7 @@ func TestMinionProxy(t *testing.T) {
...
@@ -111,7 +111,7 @@ func TestMinionProxy(t *testing.T) {
fmt
.
Sprintf
(
"/%s"
,
proxy
.
Host
)
:
"/"
,
fmt
.
Sprintf
(
"/%s"
,
proxy
.
Host
)
:
"/"
,
}
}
for
value
,
_
:=
range
failureCases
{
for
value
:=
range
failureCases
{
resp
,
err
:=
http
.
Get
(
fmt
.
Sprintf
(
"%s%s"
,
server
.
URL
,
value
))
resp
,
err
:=
http
.
Get
(
fmt
.
Sprintf
(
"%s%s"
,
server
.
URL
,
value
))
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Errorf
(
"unexpected error for %s: %v"
,
value
,
err
)
t
.
Errorf
(
"unexpected error for %s: %v"
,
value
,
err
)
...
...
pkg/kubelet/config/file.go
View file @
950f5a27
...
@@ -9,7 +9,7 @@ You may obtain a copy of the License at
...
@@ -9,7 +9,7 @@ You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
s
ied.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
impl
ied.
See the License for the specific language governing permissions and
See the License for the specific language governing permissions and
limitations under the License.
limitations under the License.
*/
*/
...
...
pkg/kubelet/config/file_test.go
View file @
950f5a27
...
@@ -73,11 +73,9 @@ func TestReadFromFile(t *testing.T) {
...
@@ -73,11 +73,9 @@ func TestReadFromFile(t *testing.T) {
expected
:=
CreatePodUpdate
(
kubelet
.
SET
,
kubelet
.
Pod
{
expected
:=
CreatePodUpdate
(
kubelet
.
SET
,
kubelet
.
Pod
{
Name
:
"test"
,
Name
:
"test"
,
Manifest
:
api
.
ContainerManifest
{
Manifest
:
api
.
ContainerManifest
{
ID
:
"test"
,
ID
:
"test"
,
Version
:
"v1beta1"
,
Version
:
"v1beta1"
,
Containers
:
[]
api
.
Container
{
api
.
Container
{
Containers
:
[]
api
.
Container
{{
Image
:
"test/image"
}},
Image
:
"test/image"
},
},
},
},
})
})
if
!
reflect
.
DeepEqual
(
expected
,
update
)
{
if
!
reflect
.
DeepEqual
(
expected
,
update
)
{
...
...
pkg/kubelet/config/http.go
View file @
950f5a27
...
@@ -9,7 +9,7 @@ You may obtain a copy of the License at
...
@@ -9,7 +9,7 @@ You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
s
ied.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
impl
ied.
See the License for the specific language governing permissions and
See the License for the specific language governing permissions and
limitations under the License.
limitations under the License.
*/
*/
...
...
pkg/kubelet/server_test.go
View file @
950f5a27
...
@@ -106,7 +106,7 @@ func TestContainer(t *testing.T) {
...
@@ -106,7 +106,7 @@ func TestContainer(t *testing.T) {
if
len
(
received
)
!=
1
{
if
len
(
received
)
!=
1
{
t
.
Errorf
(
"Expected 1 manifest, but got %v"
,
len
(
received
))
t
.
Errorf
(
"Expected 1 manifest, but got %v"
,
len
(
received
))
}
}
expectedPods
:=
[]
Pod
{
Pod
{
Name
:
"1"
,
Manifest
:
expected
[
0
]}}
expectedPods
:=
[]
Pod
{{
Name
:
"1"
,
Manifest
:
expected
[
0
]}}
if
!
reflect
.
DeepEqual
(
expectedPods
,
received
[
0
])
{
if
!
reflect
.
DeepEqual
(
expectedPods
,
received
[
0
])
{
t
.
Errorf
(
"Expected %#v, but got %#v"
,
expectedPods
,
received
[
0
])
t
.
Errorf
(
"Expected %#v, but got %#v"
,
expectedPods
,
received
[
0
])
}
}
...
@@ -129,7 +129,7 @@ func TestContainers(t *testing.T) {
...
@@ -129,7 +129,7 @@ func TestContainers(t *testing.T) {
if
len
(
received
)
!=
1
{
if
len
(
received
)
!=
1
{
t
.
Errorf
(
"Expected 1 update, but got %v"
,
len
(
received
))
t
.
Errorf
(
"Expected 1 update, but got %v"
,
len
(
received
))
}
}
expectedPods
:=
[]
Pod
{
Pod
{
Name
:
"1"
,
Manifest
:
expected
[
0
]},
Pod
{
Name
:
"2"
,
Manifest
:
expected
[
1
]}}
expectedPods
:=
[]
Pod
{
{
Name
:
"1"
,
Manifest
:
expected
[
0
]},
{
Name
:
"2"
,
Manifest
:
expected
[
1
]}}
if
!
reflect
.
DeepEqual
(
expectedPods
,
received
[
0
])
{
if
!
reflect
.
DeepEqual
(
expectedPods
,
received
[
0
])
{
t
.
Errorf
(
"Expected %#v, but got %#v"
,
expectedPods
,
received
[
0
])
t
.
Errorf
(
"Expected %#v, but got %#v"
,
expectedPods
,
received
[
0
])
}
}
...
...
pkg/util/config/config.go
View file @
950f5a27
...
@@ -9,7 +9,7 @@ You may obtain a copy of the License at
...
@@ -9,7 +9,7 @@ You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
c
ied.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
impl
ied.
See the License for the specific language governing permissions and
See the License for the specific language governing permissions and
limitations under the License.
limitations under the License.
*/
*/
...
...
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