Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Environment subcommands #89

Closed
wants to merge 14 commits into from
Prev Previous commit
Next Next commit
fixup! fixup! Add tab:"omit" struct tag
  • Loading branch information
cmoog committed Aug 2, 2020
commit 5c755707aa1ea46f36cf1da2ccab6c38acca3dca
4 changes: 2 additions & 2 deletions internal/entclient/me.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import (

// User describes a Coder user account
type User struct {
ID string `json:"id" tab:"omit"`
ID string `json:"id" tab:"-"`
Email string `json:"email"`
Username string `json:"username"`
Name string `json:"name"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at" tab:"omit"`
UpdatedAt time.Time `json:"updated_at" tab:"-"`
}

// Me gets the details of the authenticated user
Expand Down
4 changes: 2 additions & 2 deletions internal/entclient/secrets.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import (

// Secret describes a Coder secret
type Secret struct {
ID string `json:"id" tab:"omit"`
ID string `json:"id" tab:"-"`
Name string `json:"name"`
Value string `json:"value,omitempty"`
Description string `json:"description"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at" tab:"omit"`
UpdatedAt time.Time `json:"updated_at" tab:"-"`
}

// Secrets gets all secrets owned by the authed user
Expand Down
6 changes: 3 additions & 3 deletions internal/x/xtabwriter/tabwriter.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func NewWriter() *tabwriter.Writer {

// StructValues tab delimits the values of a given struct.
//
// Tag a field `tab:"omit"` to hide it from output.
// Tag a field `tab:"-"` to hide it from output.
func StructValues(data interface{}) string {
v := reflect.ValueOf(data)
s := &strings.Builder{}
Expand All @@ -32,7 +32,7 @@ func StructValues(data interface{}) string {

// StructFieldNames tab delimits the field names of a given struct.
//
// Tag a field `tab:"omit"` to hide it from output.
// Tag a field `tab:"-"` to hide it from output.
func StructFieldNames(data interface{}) string {
v := reflect.ValueOf(data)
s := &strings.Builder{}
Expand All @@ -47,5 +47,5 @@ func StructFieldNames(data interface{}) string {
}

func shouldHideField(f reflect.StructField) bool {
return f.Tag.Get(structFieldTagKey) == "omit"
return f.Tag.Get(structFieldTagKey) == "-"
}