Remove enumvalue_customname, goproto_enum_prefix and enum_customname

This commit removes gogoproto.enumvalue_customname,
gogoproto.goproto_enum_prefix and gogoproto.enum_customname.

All of them make proto-generated Go code more idiomatic, but we already
don't use these enums in our external-surfacing types and they are anyway
not supported by Google's official toolchain (see #6564).

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
This commit is contained in:
Kazuyoshi Kato
2022-03-21 19:07:10 +00:00
parent 977cb8bef0
commit 067611fdea
22 changed files with 269 additions and 361 deletions

View File

@@ -373,12 +373,12 @@ func (s *service) Write(session api.Content_WriteServer) (err error) {
}
switch req.Action {
case api.WriteActionStat:
case api.WriteAction_STAT:
msg.Digest = wr.Digest().String()
msg.StartedAt = ws.StartedAt
msg.UpdatedAt = ws.UpdatedAt
msg.Total = total
case api.WriteActionWrite, api.WriteActionCommit:
case api.WriteAction_WRITE, api.WriteAction_COMMIT:
if req.Offset > 0 {
// validate the offset if provided
if req.Offset != ws.Offset {
@@ -411,7 +411,7 @@ func (s *service) Write(session api.Content_WriteServer) (err error) {
msg.Offset += int64(n)
}
if req.Action == api.WriteActionCommit {
if req.Action == api.WriteAction_COMMIT {
var opts []content.Opt
if req.Labels != nil {
opts = append(opts, content.WithLabels(req.Labels))
@@ -428,7 +428,7 @@ func (s *service) Write(session api.Content_WriteServer) (err error) {
return err
}
if req.Action == api.WriteActionCommit {
if req.Action == api.WriteAction_COMMIT {
return nil
}

View File

@@ -276,12 +276,12 @@ func (s *service) Cleanup(ctx context.Context, cr *snapshotsapi.CleanupRequest)
func fromKind(kind snapshots.Kind) snapshotsapi.Kind {
if kind == snapshots.KindActive {
return snapshotsapi.KindActive
return snapshotsapi.Kind_ACTIVE
}
if kind == snapshots.KindView {
return snapshotsapi.KindView
return snapshotsapi.Kind_VIEW
}
return snapshotsapi.KindCommitted
return snapshotsapi.Kind_COMMITTED
}
func fromInfo(info snapshots.Info) snapshotsapi.Info {
@@ -326,10 +326,10 @@ func toInfo(info snapshotsapi.Info) snapshots.Info {
}
func toKind(kind snapshotsapi.Kind) snapshots.Kind {
if kind == snapshotsapi.KindActive {
if kind == snapshotsapi.Kind_ACTIVE {
return snapshots.KindActive
}
if kind == snapshotsapi.KindView {
if kind == snapshotsapi.Kind_VIEW {
return snapshots.KindView
}
return snapshots.KindCommitted

View File

@@ -333,18 +333,18 @@ func getProcessState(ctx context.Context, p runtime.Process) (*task.Process, err
}
log.G(ctx).WithError(err).Errorf("get state for %s", p.ID())
}
status := task.StatusUnknown
status := task.Status_UNKNOWN
switch state.Status {
case runtime.CreatedStatus:
status = task.StatusCreated
status = task.Status_CREATED
case runtime.RunningStatus:
status = task.StatusRunning
status = task.Status_RUNNING
case runtime.StoppedStatus:
status = task.StatusStopped
status = task.Status_STOPPED
case runtime.PausedStatus:
status = task.StatusPaused
status = task.Status_PAUSED
case runtime.PausingStatus:
status = task.StatusPausing
status = task.Status_PAUSING
default:
log.G(ctx).WithField("status", state.Status).Warn("unknown status")
}