Skip to content

Commit

Permalink
golint: remove underscores from Go names
Browse files Browse the repository at this point in the history
Fixes warnings similiar to

... warning: don't use underscores in Go names; var x_yZ should be xYZ (golint)

While the diff speaks for itself a summary of the replace

o s/service_deleteCmd/serviceDeleteCmd
o s/sub_decision/subDecision
o s/endpoint_configCmd/endpointConfigCmd
o s/bash_completion_func/bashCompletionFunc
o s/len_a/lenA
o s/len_b/lenB
o s/policy_validateCmd/policyValidateCmd
o s/identity_getCmd/identityGetCmd
o s/bpf_policy_addCmd/bpfPolicyAddCmd
o s/peer_lbl/peerLbl
o s/service_updateCmd/serviceUpdateCmd
o s/bash_completionCmd/bashCompletionCmd
o s/endpoint_disconnectCmd/endpointDisconnectCmd
o s/always_allow/alwaysAllow
o s/bpf_policyCmd/bpfPolicyCmd
o s/bpf_policy_listCmd/bpfPolicyListCmd
o s/policy_importCmd/policyImportCmd
o s/bpf_policy_deleteCmd/bpfPolicyDeleteCmd
o s/policy_traceCmd/policyTraceCmd
o s/endpoint_labelsCmd/endpointLabelsCmd
o s/endpoint_regenerateCmd/endpointRegenerateCmd
o s/pr_{c,r,l4}/pr{C,R,L4}
o s/policy_deleteCmd/policyDeleteCmd
o s/ip_2/ip2
o s/bpf_ctCmd/bpfCtCmd
o s/policy_getCmd/policyGetCmd
o s/filter_http/filterHttp
o s/filter_90_to_92/filter90To92
o s/service_getCmd/serviceGetCmd
o s/bpf_ct_listCmd/bpfCtListCmd
o s/service_listCmd/serviceListCmd
o s/endpoint_getCmd/endpointGetCmd
o s/endpoint_listCmd/endpointListCmd
o s/update_ok/updateOk

Related-to: #153 (Resolve golint warnings)
Signed-off-by: Alexander Alemayhu <alexander@alemayhu.com>
  • Loading branch information
aalemayhu authored and tgraf committed Mar 18, 2017
1 parent d761e03 commit d71b9bd
Show file tree
Hide file tree
Showing 32 changed files with 142 additions and 142 deletions.
6 changes: 3 additions & 3 deletions cilium/cmd/bash_completion.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import (
"github.com/spf13/cobra"
)

// bash_completionCmd represents the bash_completion command
var bash_completionCmd = &cobra.Command{
// bashCompletionCmd represents the bash_completion command
var bashCompletionCmd = &cobra.Command{
Use: "generate-bash-completion",
Short: "Hidden bash completion command",
Hidden: true,
Expand All @@ -34,5 +34,5 @@ var bash_completionCmd = &cobra.Command{
}

func init() {
RootCmd.AddCommand(bash_completionCmd)
RootCmd.AddCommand(bashCompletionCmd)
}
6 changes: 3 additions & 3 deletions cilium/cmd/bpf_ct.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ import (
"github.com/spf13/cobra"
)

// bpf_ctCmd represents the bpf_ct command
var bpf_ctCmd = &cobra.Command{
// bpfCtCmd represents the bpf_ct command
var bpfCtCmd = &cobra.Command{
Use: "ct",
Short: "Connection tracking tables",
}

func init() {
bpfCmd.AddCommand(bpf_ctCmd)
bpfCmd.AddCommand(bpfCtCmd)
}
6 changes: 3 additions & 3 deletions cilium/cmd/bpf_ct_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import (
"github.com/spf13/cobra"
)

// bpf_ct_listCmd represents the bpf_ct_list command
var bpf_ct_listCmd = &cobra.Command{
// bpfCtListCmd represents the bpf_ct_list command
var bpfCtListCmd = &cobra.Command{
Use: "list",
Short: "List connection tracking entries",
PreRun: requireEndpointID,
Expand All @@ -35,7 +35,7 @@ var bpf_ct_listCmd = &cobra.Command{
}

func init() {
bpf_ctCmd.AddCommand(bpf_ct_listCmd)
bpfCtCmd.AddCommand(bpfCtListCmd)
}

func dumpCtProto(name string, ctType ctmap.CtType) {
Expand Down
6 changes: 3 additions & 3 deletions cilium/cmd/bpf_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ import (
"github.com/spf13/cobra"
)

// bpf_policyCmd represents the bpf_policy command
var bpf_policyCmd = &cobra.Command{
// bpfPolicyCmd represents the bpf_policy command
var bpfPolicyCmd = &cobra.Command{
Use: "policy",
Short: "Manage policy related BPF maps",
}

func init() {
bpfCmd.AddCommand(bpf_policyCmd)
bpfCmd.AddCommand(bpfPolicyCmd)
}
12 changes: 6 additions & 6 deletions cilium/cmd/bpf_policy_add.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import (
"github.com/spf13/cobra"
)

// bpf_policy_addCmd represents the bpf_policy_add command
var bpf_policy_addCmd = &cobra.Command{
// bpfPolicyAddCmd represents the bpf_policy_add command
var bpfPolicyAddCmd = &cobra.Command{
Use: "add <endpoint id> <identity>",
Short: "Add/update policy entry",
PreRun: requireEndpointID,
Expand All @@ -35,7 +35,7 @@ var bpf_policy_addCmd = &cobra.Command{
}

func init() {
bpf_policyCmd.AddCommand(bpf_policy_addCmd)
bpfPolicyCmd.AddCommand(bpfPolicyAddCmd)
}

func updatePolicyKey(cmd *cobra.Command, args []string, add bool) {
Expand All @@ -54,13 +54,13 @@ func updatePolicyKey(cmd *cobra.Command, args []string, add bool) {
Fatalf("Cannot open policymap '%s' : %s", file, err)
}

peer_lbl, err := strconv.ParseUint(args[1], 10, 32)
peerLbl, err := strconv.ParseUint(args[1], 10, 32)
if add == true {
if err := policyMap.AllowConsumer(uint32(peer_lbl)); err != nil {
if err := policyMap.AllowConsumer(uint32(peerLbl)); err != nil {
Fatalf("Cannot add policy key: %s", err)
}
} else {
if err := policyMap.DeleteConsumer(uint32(peer_lbl)); err != nil {
if err := policyMap.DeleteConsumer(uint32(peerLbl)); err != nil {
Fatalf("Cannot delete policy key: %s", err)
}
}
Expand Down
6 changes: 3 additions & 3 deletions cilium/cmd/bpf_policy_delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import (
"github.com/spf13/cobra"
)

// bpf_policy_deleteCmd represents the bpf_policy_delete command
var bpf_policy_deleteCmd = &cobra.Command{
// bpfPolicyDeleteCmd represents the bpf_policy_delete command
var bpfPolicyDeleteCmd = &cobra.Command{
Use: "delete <endpoint id> <identity>",
Short: "Delete a policy entry",
PreRun: requireEndpointID,
Expand All @@ -29,5 +29,5 @@ var bpf_policy_deleteCmd = &cobra.Command{
}

func init() {
bpf_policyCmd.AddCommand(bpf_policy_deleteCmd)
bpfPolicyCmd.AddCommand(bpfPolicyDeleteCmd)
}
8 changes: 4 additions & 4 deletions cilium/cmd/bpf_policy_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ import (

var printIDs bool

// bpf_policy_listCmd represents the bpf_policy_list command
var bpf_policy_listCmd = &cobra.Command{
// bpfPolicyListCmd represents the bpf_policy_list command
var bpfPolicyListCmd = &cobra.Command{
Use: "list",
Short: "List contents of a policy BPF map",
PreRun: requireEndpointID,
Expand All @@ -40,8 +40,8 @@ var bpf_policy_listCmd = &cobra.Command{
}

func init() {
bpf_policyCmd.AddCommand(bpf_policy_listCmd)
bpf_policy_listCmd.Flags().BoolVarP(&printIDs, "numeric", "n", false, "Do not resolve IDs")
bpfPolicyCmd.AddCommand(bpfPolicyListCmd)
bpfPolicyListCmd.Flags().BoolVarP(&printIDs, "numeric", "n", false, "Do not resolve IDs")
}

func listMap(cmd *cobra.Command, args []string) {
Expand Down
8 changes: 4 additions & 4 deletions cilium/cmd/endpoint_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import (

var listOptions bool

// endpoint_configCmd represents the endpoint_config command
var endpoint_configCmd = &cobra.Command{
// endpointConfigCmd represents the endpoint_config command
var endpointConfigCmd = &cobra.Command{
Use: "config <endpoint id> [<option>=(enable|disable) ...]",
Short: "View & modify endpoint configuration",
Example: "endpoint config 5421 DropNotification=disable",
Expand All @@ -43,8 +43,8 @@ var endpoint_configCmd = &cobra.Command{
}

func init() {
endpointCmd.AddCommand(endpoint_configCmd)
endpoint_configCmd.Flags().BoolVarP(&listOptions, "list-options", "", false, "List available options")
endpointCmd.AddCommand(endpointConfigCmd)
endpointConfigCmd.Flags().BoolVarP(&listOptions, "list-options", "", false, "List available options")
}

func listEndpointOptions() {
Expand Down
6 changes: 3 additions & 3 deletions cilium/cmd/endpoint_disconnect.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import (
"github.com/spf13/cobra"
)

// endpoint_disconnectCmd represents the endpoint_disconnect command
var endpoint_disconnectCmd = &cobra.Command{
// endpointDisconnectCmd represents the endpoint_disconnect command
var endpointDisconnectCmd = &cobra.Command{
Use: "disconnect <endpoint-id>",
Short: "Disconnect an endpoint from the network",
PreRun: requireEndpointID,
Expand All @@ -36,6 +36,6 @@ var endpoint_disconnectCmd = &cobra.Command{
}

func init() {
endpointCmd.AddCommand(endpoint_disconnectCmd)
endpointCmd.AddCommand(endpointDisconnectCmd)

}
6 changes: 3 additions & 3 deletions cilium/cmd/endpoint_get.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import (
"github.com/spf13/cobra"
)

// endpoint_getCmd represents the endpoint_get command
var endpoint_getCmd = &cobra.Command{
// endpointGetCmd represents the endpoint_get command
var endpointGetCmd = &cobra.Command{
Use: "get <endpoint-id>",
Aliases: []string{"inspect, show"},
Short: "Display endpoint information",
Expand All @@ -41,5 +41,5 @@ var endpoint_getCmd = &cobra.Command{
}

func init() {
endpointCmd.AddCommand(endpoint_getCmd)
endpointCmd.AddCommand(endpointGetCmd)
}
10 changes: 5 additions & 5 deletions cilium/cmd/endpoint_labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ var (
toDelete []string
)

// endpoint_labelsCmd represents the endpoint_labels command
var endpoint_labelsCmd = &cobra.Command{
// endpointLabelsCmd represents the endpoint_labels command
var endpointLabelsCmd = &cobra.Command{
Use: "labels",
Short: "Manage label configuration of endpoint",
PreRun: requireEndpointID,
Expand Down Expand Up @@ -65,9 +65,9 @@ var endpoint_labelsCmd = &cobra.Command{
}

func init() {
endpointCmd.AddCommand(endpoint_labelsCmd)
endpoint_labelsCmd.Flags().StringSliceVarP(&toAdd, "add", "a", []string{}, "Add/enable labels")
endpoint_labelsCmd.Flags().StringSliceVarP(&toDelete, "delete", "d", []string{}, "Delete/disable labels")
endpointCmd.AddCommand(endpointLabelsCmd)
endpointLabelsCmd.Flags().StringSliceVarP(&toAdd, "add", "a", []string{}, "Add/enable labels")
endpointLabelsCmd.Flags().StringSliceVarP(&toDelete, "delete", "d", []string{}, "Delete/disable labels")
}

func printEndpointLabels(lbls *labels.OpLabels) {
Expand Down
8 changes: 4 additions & 4 deletions cilium/cmd/endpoint_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import (

var noHeaders bool

// endpoint_listCmd represents the endpoint_list command
var endpoint_listCmd = &cobra.Command{
// endpointListCmd represents the endpoint_list command
var endpointListCmd = &cobra.Command{
Use: "list",
Short: "List all endpoints",
Run: func(cmd *cobra.Command, args []string) {
Expand All @@ -36,8 +36,8 @@ var endpoint_listCmd = &cobra.Command{
}

func init() {
endpointCmd.AddCommand(endpoint_listCmd)
endpoint_listCmd.Flags().BoolVar(&noHeaders, "no-headers", false, "Do not print headers")
endpointCmd.AddCommand(endpointListCmd)
endpointListCmd.Flags().BoolVar(&noHeaders, "no-headers", false, "Do not print headers")
}

func listEndpoint(w *tabwriter.Writer, ep *models.Endpoint, id string, label string) {
Expand Down
6 changes: 3 additions & 3 deletions cilium/cmd/endpoint_regenerate.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import (
"github.com/spf13/cobra"
)

// endpoint_regenerateCmd represents the endpoint_regenerate command
var endpoint_regenerateCmd = &cobra.Command{
// endpointRegenerateCmd represents the endpoint_regenerate command
var endpointRegenerateCmd = &cobra.Command{
Use: "regenerate <endpoint-id>",
Short: "Force regeneration of endpoint program",
PreRun: requireEndpointID,
Expand All @@ -36,5 +36,5 @@ var endpoint_regenerateCmd = &cobra.Command{
}

func init() {
endpointCmd.AddCommand(endpoint_regenerateCmd)
endpointCmd.AddCommand(endpointRegenerateCmd)
}
8 changes: 4 additions & 4 deletions cilium/cmd/identity_get.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import (

var listID bool

// identity_getCmd represents the identity_get command
var identity_getCmd = &cobra.Command{
// identityGetCmd represents the identity_get command
var identityGetCmd = &cobra.Command{
Use: "get",
Short: "A brief description of your command",
Run: func(cmd *cobra.Command, args []string) {
Expand All @@ -50,6 +50,6 @@ var identity_getCmd = &cobra.Command{
}

func init() {
identityCmd.AddCommand(identity_getCmd)
identity_getCmd.Flags().BoolVarP(&listID, "list", "", false, "List all identities")
identityCmd.AddCommand(identityGetCmd)
identityGetCmd.Flags().BoolVarP(&listID, "list", "", false, "List all identities")
}
6 changes: 3 additions & 3 deletions cilium/cmd/policy_delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import (
"github.com/spf13/cobra"
)

// policy_deleteCmd represents the policy_delete command
var policy_deleteCmd = &cobra.Command{
// policyDeleteCmd represents the policy_delete command
var policyDeleteCmd = &cobra.Command{
Use: "delete <policy-path>",
Short: "Delete a policy tree node",
PreRun: requirePath,
Expand All @@ -32,5 +32,5 @@ var policy_deleteCmd = &cobra.Command{
}

func init() {
policyCmd.AddCommand(policy_deleteCmd)
policyCmd.AddCommand(policyDeleteCmd)
}
6 changes: 3 additions & 3 deletions cilium/cmd/policy_get.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import (
"github.com/spf13/cobra"
)

// policy_getCmd represents the policy_get command
var policy_getCmd = &cobra.Command{
// policyGetCmd represents the policy_get command
var policyGetCmd = &cobra.Command{
Use: "get <policy-path>",
Short: "Display policy node information",
PreRun: requirePath,
Expand All @@ -36,5 +36,5 @@ var policy_getCmd = &cobra.Command{
}

func init() {
policyCmd.AddCommand(policy_getCmd)
policyCmd.AddCommand(policyGetCmd)
}
8 changes: 4 additions & 4 deletions cilium/cmd/policy_import.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import (

var printPolicy bool

// policy_importCmd represents the policy_import command
var policy_importCmd = &cobra.Command{
// policyImportCmd represents the policy_import command
var policyImportCmd = &cobra.Command{
Use: "import <path>",
Short: "Import security policy",
Example: ` cilium policy import ~/app.policy
Expand Down Expand Up @@ -52,6 +52,6 @@ var policy_importCmd = &cobra.Command{
}

func init() {
policyCmd.AddCommand(policy_importCmd)
policy_importCmd.Flags().BoolVarP(&printPolicy, "print", "", false, "Print policy after import")
policyCmd.AddCommand(policyImportCmd)
policyImportCmd.Flags().BoolVarP(&printPolicy, "print", "", false, "Print policy after import")
}
14 changes: 7 additions & 7 deletions cilium/cmd/policy_trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ import (

var src, dst []string

// policy_traceCmd represents the policy_trace command
var policy_traceCmd = &cobra.Command{
// policyTraceCmd represents the policy_trace command
var policyTraceCmd = &cobra.Command{
Use: "trace -s <context> -d <context>",
Short: "Trace a policy decision",
Long: `Verifies if source ID or LABEL(s) is allowed to consume
Expand Down Expand Up @@ -62,11 +62,11 @@ SOURCE:KEY[=VALUE]`,
}

func init() {
policyCmd.AddCommand(policy_traceCmd)
policy_traceCmd.Flags().StringSliceVarP(&src, "src", "s", []string{}, "Source label context")
policy_traceCmd.MarkFlagRequired("src")
policy_traceCmd.Flags().StringSliceVarP(&dst, "dst", "d", []string{}, "Destination label context")
policy_traceCmd.MarkFlagRequired("dst")
policyCmd.AddCommand(policyTraceCmd)
policyTraceCmd.Flags().StringSliceVarP(&src, "src", "s", []string{}, "Source label context")
policyTraceCmd.MarkFlagRequired("src")
policyTraceCmd.Flags().StringSliceVarP(&dst, "dst", "d", []string{}, "Destination label context")
policyTraceCmd.MarkFlagRequired("dst")
}

func parseAllowedSlice(slice []string) ([]string, error) {
Expand Down
8 changes: 4 additions & 4 deletions cilium/cmd/policy_validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import (
"github.com/spf13/cobra"
)

// policy_validateCmd represents the policy_validate command
var policy_validateCmd = &cobra.Command{
// policyValidateCmd represents the policy_validate command
var policyValidateCmd = &cobra.Command{
Use: "validate <path>",
Short: "Validate a policy",
PreRun: requirePath,
Expand All @@ -41,7 +41,7 @@ var policy_validateCmd = &cobra.Command{
}

func init() {
policyCmd.AddCommand(policy_validateCmd)
policy_validateCmd.Flags().BoolVarP(&printPolicy, "print", "", false, "Print policy after validation")
policyCmd.AddCommand(policyValidateCmd)
policyValidateCmd.Flags().BoolVarP(&printPolicy, "print", "", false, "Print policy after validation")

}

0 comments on commit d71b9bd

Please sign in to comment.