Skip to content

Commit

Permalink
Update golang-ci lint version and fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
rajat-mangla committed Oct 6, 2021
1 parent fa16013 commit 76b8d15
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion build/build-image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ RUN curl -L ${HELM_URL} > /tmp/helm.tar.gz \
RUN echo "source <(helm completion bash)" >> /root/.bashrc

# install golang-ci linter
RUN curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $GOPATH/bin v1.30.0
RUN curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $GOPATH/bin v1.42.1

#
# \ \ / /__| |__ ___(_) |_ ___
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/autoscaling/v1/fleetautoscaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ func (w *WebhookPolicy) ValidateWebhookPolicy(causes []metav1.StatusCause) []met
}
if w.CABundle != nil {
rootCAs := x509.NewCertPool()
//Check that CABundle provided is correctly encoded certificate
// Check that CABundle provided is correctly encoded certificate
if ok := rootCAs.AppendCertsFromPEM(w.CABundle); !ok {
causes = append(causes, metav1.StatusCause{
Type: metav1.CauseTypeFieldValueInvalid,
Expand Down
3 changes: 2 additions & 1 deletion pkg/fleets/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,8 @@ func (c *Controller) rollingUpdateRestFixedOnReady(ctx context.Context, fleet *a

totalScaleDownCount := int32(0)
// Check if we can scale down.
allGSS := append(rest, active)
allGSS := rest
allGSS = append(allGSS, active)
readyReplicasCount := agonesv1.GetReadyReplicaCountForGameServerSets(allGSS)
minAvailable := fleet.Spec.Replicas - unavailable

Expand Down
2 changes: 1 addition & 1 deletion pkg/gameservers/migration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ func TestMigrationControllerSyncGameServer(t *testing.T) {
return true, &corev1.PodList{Items: []corev1.Pod{*pod}}, nil
})

//check values
// check values
updated := false
m.AgonesClient.AddReactor("update", "gameservers", func(action k8stesting.Action) (bool, runtime.Object, error) {
updated = true
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/fleet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func TestFleetStrategyValidation(t *testing.T) {
func TestFleetScaleUpEditAndScaleDown(t *testing.T) {
t.Parallel()

//Use scaleFleetPatch (true) or scaleFleetSubresource (false)
// Use scaleFleetPatch (true) or scaleFleetSubresource (false)
fixtures := []bool{true, false}

for _, usePatch := range fixtures {
Expand Down Expand Up @@ -222,7 +222,7 @@ func TestFleetScaleUpEditAndScaleDown(t *testing.T) {
func TestFleetRollingUpdate(t *testing.T) {
t.Parallel()
ctx := context.Background()
//Use scaleFleetPatch (true) or scaleFleetSubresource (false)
// Use scaleFleetPatch (true) or scaleFleetSubresource (false)
fixtures := []bool{true, false}
maxSurge := []string{"25%", "10%"}

Expand Down
6 changes: 3 additions & 3 deletions test/e2e/fleetautoscaler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func TestAutoscalerBasicFunctions(t *testing.T) {
_, err = patchFleetAutoscaler(ctx, fas, intstr.FromString("10%"), 1, fas.Spec.Policy.Buffer.MaxReplicas)
assert.Nil(t, err, "could not patch fleetautoscaler")

//10% with only one allocated GS means only one ready server
// 10% with only one allocated GS means only one ready server
framework.AssertFleetCondition(t, flt, e2e.FleetReadyCount(1))

// get the Status of the fleetautoscaler
Expand Down Expand Up @@ -251,7 +251,7 @@ func TestFleetAutoScalerRollingUpdate(t *testing.T) {
// In ticket #1156 we apply new Replicas size 2, which is smaller than 7
// And RollingUpdate is broken, scaling immediately from 7 to 2 and then back to 7
// Uncomment line below to break this test
//fltCopy.Spec.Replicas = 2
// fltCopy.Spec.Replicas = 2

flt, err = framework.AgonesClient.AgonesV1().Fleets(framework.Namespace).Update(ctx, fltCopy, metav1.UpdateOptions{})
assert.NoError(t, err)
Expand Down Expand Up @@ -415,7 +415,7 @@ func defaultFleetAutoscaler(f *agonesv1.Fleet, namespace string) *autoscalingv1.
}
}

//Test fleetautoscaler with webhook policy type
// Test fleetautoscaler with webhook policy type
// scaling from Replicas equals to 1 to 2
func TestAutoscalerWebhook(t *testing.T) {
t.Parallel()
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/gameserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ func TestDevelopmentGameServerLifecycle(t *testing.T) {

assert.Equal(t, readyGs.Status.State, agonesv1.GameServerStateReady)

//confirm delete works, because if the finalisers don't get removed, this won't work.
// confirm delete works, because if the finalisers don't get removed, this won't work.
err = framework.AgonesClient.AgonesV1().GameServers(framework.Namespace).Delete(ctx, readyGs.ObjectMeta.Name, metav1.DeleteOptions{})
assert.NoError(t, err)

Expand Down

0 comments on commit 76b8d15

Please sign in to comment.