Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linter fixes, remove staticcheck hook because golangci-lint includes it #6416

Merged
merged 2 commits into from
Jul 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions go/cmd/automation_client/automation_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func main() {
Parameters: params.parameters,
}
fmt.Printf("Sending request:\n%v", proto.MarshalTextString(enqueueRequest))
enqueueResponse, err := client.EnqueueClusterOperation(context.Background(), enqueueRequest, grpc.FailFast(false)) //nolint
enqueueResponse, err := client.EnqueueClusterOperation(context.Background(), enqueueRequest, grpc.WaitForReady(true))
if err != nil {
fmt.Println("Failed to enqueue ClusterOperation. Error:", err)
os.Exit(4)
Expand All @@ -113,7 +113,7 @@ func waitForClusterOp(client automationservicepb.AutomationClient, id string) (*
Id: id,
}

resp, err := client.GetClusterOperationDetails(context.Background(), req, grpc.FailFast(false)) //nolint
resp, err := client.GetClusterOperationDetails(context.Background(), req, grpc.WaitForReady(true))
if err != nil {
return nil, fmt.Errorf("failed to get ClusterOperation Details. Request: %v Error: %v", req, err)
}
Expand Down
2 changes: 1 addition & 1 deletion go/mysql/replication_constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ 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.
*/
//nolint:unparam

package mysql

// This file contains the constant definitions for this package.
Expand Down
1 change: 1 addition & 0 deletions go/test/endtoend/backup/vtctlbackup/backup_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import (
"vitess.io/vitess/go/test/endtoend/cluster"
)

// constants for test variants
const (
XtraBackup = iota
Backup
Expand Down
2 changes: 1 addition & 1 deletion go/vt/grpcclient/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func Dial(target string, failFast FailFast, opts ...grpc.DialOption) (*grpc.Clie
grpc.WithDefaultCallOptions(
grpc.MaxCallRecvMsgSize(*grpccommon.MaxMessageSize),
grpc.MaxCallSendMsgSize(*grpccommon.MaxMessageSize),
grpc.FailFast(bool(failFast)), //nolint
grpc.WaitForReady(bool(!failFast)),
),
}

Expand Down
18 changes: 9 additions & 9 deletions go/vt/vttablet/faketmclient/fake_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,47 +285,47 @@ func (client *FakeTabletManagerClient) PromoteReplica(ctx context.Context, table
return "", nil
}

//Deprecated
// StopSlave is deprecated
func (client *FakeTabletManagerClient) StopSlave(ctx context.Context, tablet *topodatapb.Tablet) error {
return nil
}

//Deprecated
// StopSlaveMinimum is deprecated
func (client *FakeTabletManagerClient) StopSlaveMinimum(ctx context.Context, tablet *topodatapb.Tablet, minPos string, waitTime time.Duration) (string, error) {
return "", nil
}

//Deprecated
// StartSlave is deprecated
func (client *FakeTabletManagerClient) StartSlave(ctx context.Context, tablet *topodatapb.Tablet) error {
return nil
}

//Deprecated
// StartSlaveUntilAfter is deprecated
func (client *FakeTabletManagerClient) StartSlaveUntilAfter(ctx context.Context, tablet *topodatapb.Tablet, position string, duration time.Duration) error {
return nil
}

//Deprecated
// GetSlaves is deprecated
func (client *FakeTabletManagerClient) GetSlaves(ctx context.Context, tablet *topodatapb.Tablet) ([]string, error) {
return nil, nil
}

//Deprecated
// SlaveStatus is deprecated
func (client *FakeTabletManagerClient) SlaveStatus(ctx context.Context, tablet *topodatapb.Tablet) (*replicationdatapb.Status, error) {
return &replicationdatapb.Status{}, nil
}

//Deprecated
// InitSlave is deprecated
func (client *FakeTabletManagerClient) InitSlave(ctx context.Context, tablet *topodatapb.Tablet, parent *topodatapb.TabletAlias, position string, timeCreatedNS int64) error {
return nil
}

//Deprecated
// SlaveWasPromoted is deprecated
func (client *FakeTabletManagerClient) SlaveWasPromoted(ctx context.Context, tablet *topodatapb.Tablet) error {
return nil
}

//Deprecated
// SlaveWasRestarted is deprecated
func (client *FakeTabletManagerClient) SlaveWasRestarted(ctx context.Context, tablet *topodatapb.Tablet, parent *topodatapb.TabletAlias) error {
return nil
}
Expand Down
18 changes: 9 additions & 9 deletions go/vt/vttablet/grpctmclient/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,7 @@ func (client *Client) Close() {
client.rpcClientMap = nil
}

// Deprecated
// SlaveStatus is deprecated
func (client *Client) SlaveStatus(ctx context.Context, tablet *topodatapb.Tablet) (*replicationdatapb.Status, error) {
cc, c, err := client.dial(tablet)
if err != nil {
Expand All @@ -837,7 +837,7 @@ func (client *Client) SlaveStatus(ctx context.Context, tablet *topodatapb.Tablet
return response.Status, nil
}

// Deprecated
// StopSlave is deprecated
func (client *Client) StopSlave(ctx context.Context, tablet *topodatapb.Tablet) error {
cc, c, err := client.dial(tablet)
if err != nil {
Expand All @@ -848,7 +848,7 @@ func (client *Client) StopSlave(ctx context.Context, tablet *topodatapb.Tablet)
return err
}

// Deprecated
// StopSlaveMinimum is deprecated
func (client *Client) StopSlaveMinimum(ctx context.Context, tablet *topodatapb.Tablet, minPos string, waitTime time.Duration) (string, error) {
cc, c, err := client.dial(tablet)
if err != nil {
Expand All @@ -865,7 +865,7 @@ func (client *Client) StopSlaveMinimum(ctx context.Context, tablet *topodatapb.T
return response.Position, nil
}

// Deprecated
// StartSlave is deprecated
func (client *Client) StartSlave(ctx context.Context, tablet *topodatapb.Tablet) error {
cc, c, err := client.dial(tablet)
if err != nil {
Expand All @@ -876,7 +876,7 @@ func (client *Client) StartSlave(ctx context.Context, tablet *topodatapb.Tablet)
return err
}

// Deprecated
// StartSlaveUntilAfter is deprecated
func (client *Client) StartSlaveUntilAfter(ctx context.Context, tablet *topodatapb.Tablet, position string, waitTime time.Duration) error {
cc, c, err := client.dial(tablet)
if err != nil {
Expand All @@ -890,7 +890,7 @@ func (client *Client) StartSlaveUntilAfter(ctx context.Context, tablet *topodata
return err
}

// Deprecated
// GetSlaves is deprecated
func (client *Client) GetSlaves(ctx context.Context, tablet *topodatapb.Tablet) ([]string, error) {
cc, c, err := client.dial(tablet)
if err != nil {
Expand All @@ -904,7 +904,7 @@ func (client *Client) GetSlaves(ctx context.Context, tablet *topodatapb.Tablet)
return response.Addrs, nil
}

// Deprecated
// InitSlave is deprecated
func (client *Client) InitSlave(ctx context.Context, tablet *topodatapb.Tablet, parent *topodatapb.TabletAlias, replicationPosition string, timeCreatedNS int64) error {
cc, c, err := client.dial(tablet)
if err != nil {
Expand All @@ -919,7 +919,7 @@ func (client *Client) InitSlave(ctx context.Context, tablet *topodatapb.Tablet,
return err
}

// Deprecated
// SlaveWasPromoted is deprecated
func (client *Client) SlaveWasPromoted(ctx context.Context, tablet *topodatapb.Tablet) error {
cc, c, err := client.dial(tablet)
if err != nil {
Expand All @@ -930,7 +930,7 @@ func (client *Client) SlaveWasPromoted(ctx context.Context, tablet *topodatapb.T
return err
}

// Deprecated
// SlaveWasRestarted is deprecated
func (client *Client) SlaveWasRestarted(ctx context.Context, tablet *topodatapb.Tablet, parent *topodatapb.TabletAlias) error {
cc, c, err := client.dial(tablet)
if err != nil {
Expand Down
18 changes: 9 additions & 9 deletions go/vt/vttablet/tabletmanager/rpc_replication.go
Original file line number Diff line number Diff line change
Expand Up @@ -748,47 +748,47 @@ func (tm *TabletManager) handleRelayLogError(err error) error {
return err
}

// Deprecated delete after 7.0
// SlaveStatus is deprecated
func (tm *TabletManager) SlaveStatus(ctx context.Context) (*replicationdatapb.Status, error) {
return tm.ReplicationStatus(ctx)
}

// Deprecated delete after 7.0
// StopSlave is deprecated
func (tm *TabletManager) StopSlave(ctx context.Context) error {
return tm.StopReplication(ctx)
}

// Deprecated delete after 7.0
// StopSlaveMinimum is deprecated
func (tm *TabletManager) StopSlaveMinimum(ctx context.Context, position string, waitTime time.Duration) (string, error) {
return tm.StopReplicationMinimum(ctx, position, waitTime)
}

// Deprecated delete after 7.0
// StartSlave is deprecated
func (tm *TabletManager) StartSlave(ctx context.Context) error {
return tm.StartReplication(ctx)
}

// Deprecated delete after 7.0
// StartSlaveUntilAfter is deprecated
func (tm *TabletManager) StartSlaveUntilAfter(ctx context.Context, position string, waitTime time.Duration) error {
return tm.StartReplicationUntilAfter(ctx, position, waitTime)
}

// Deprecated delete after 7.0
// GetSlaves is deprecated
func (tm *TabletManager) GetSlaves(ctx context.Context) ([]string, error) {
return tm.GetReplicas(ctx)
}

// Deprecated delete after 7.0
// InitSlave is deprecated
func (tm *TabletManager) InitSlave(ctx context.Context, parent *topodatapb.TabletAlias, position string, timeCreatedNS int64) error {
return tm.InitReplica(ctx, parent, position, timeCreatedNS)
}

// Deprecated delete after 7.0
// SlaveWasPromoted is deprecated
func (tm *TabletManager) SlaveWasPromoted(ctx context.Context) error {
return tm.ReplicaWasPromoted(ctx)
}

// Deprecated delete after 7.0
// SlaveWasRestarted is deprecated
func (tm *TabletManager) SlaveWasRestarted(ctx context.Context, parent *topodatapb.TabletAlias) error {
return tm.ReplicaWasRestarted(ctx, parent)
}
12 changes: 6 additions & 6 deletions go/vt/worker/diff_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -559,22 +559,22 @@ func (rd *RowDiffer) Go(log logutil.Logger) (dr DiffReport, err error) {

// drain right, update count
log.Errorf("Draining extra row(s) found on the right starting with: %v", right)
if count, err := rd.right.Drain(); err != nil {
var count int
if count, err = rd.right.Drain(); err != nil {
return dr, err
} else {
dr.extraRowsRight += 1 + count
}
dr.extraRowsRight += 1 + count
return
}
if right == nil {
// no more rows from the right
// we know we have rows from left, drain, update count
log.Errorf("Draining extra row(s) found on the left starting with: %v", left)
if count, err := rd.left.Drain(); err != nil {
var count int
if count, err = rd.left.Drain(); err != nil {
return dr, err
} else {
dr.extraRowsLeft += 1 + count
}
dr.extraRowsLeft += 1 + count
return
}

Expand Down
70 changes: 0 additions & 70 deletions misc/git/hooks/staticcheck

This file was deleted.