Skip to content

If we need a code style?  #1755

@pherzheyu

Description

@pherzheyu

What would you like to be added:

Good Code Style.

Why is this needed:

  1. Standardized code promotes teamwork
  2. Standardized code can reduce bug handling
  3. Standardized code can reduce maintenance costs
  4. Standardized code helps code review

How:
Although golang does not have a recognized code specification, we can refer to those:
https://go.dev/ref/spec
https://github.com/golang/go/wiki/CodeReviewComments
https://github.com/uber-go/guide/blob/master/style.md

e.g.

var localIp string

func GetLocalIp() string {

}

into

var localIP string

func GetLocalIP() string {

}
type Service struct {
	name     string
	rcvr     reflect.Value
	rcvrType reflect.Type
	methods  map[string]*MethodType
}

into

type Service struct {
	name    string
	rv      reflect.Value // receiveValue
	rt      reflect.Type  // receiveType
	methods map[string]*MethodType
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions