Skip to content

datapages fmt source package code formatting command #20

Description

@romshark

Problem

Currently, the source package code formatting convention is not enforceable.

Proposed Solution

The datapages fmt command should be a superset of go fmt and should format the source package according to Datapages convention.

Input parameter order

func (PageFoo) GET(
  sessionToken string,
  session Session,
  r *http.Request,
) {

to

func (PageFoo) GET(
  r *http.Request,
  session Session,
  sessionToken string,
) {

func (PageIndex) OnEventX(
  session Session,
  sse *datastar.ServerSentEventGenerator,
  event EventX,
) {

to

func (PageIndex) OnEventX(
  event EventX,
  sse *datastar.ServerSentEventGenerator,
  session Session,
) {

Spaces/tabs in comments

// EventFoo   is   "asd"
type EventFoo struct {
  Bar int `json:"bar"`
}

to

// EventFoo is "asd"
type EventFoo struct {
  Bar int `json:"bar"`
}

// PageFoo   is   /foo
type EventFoo struct { App *App }

to

// EventFoo is /foo
type EventFoo struct { App *App }

Empty line between event head and arbitrary description.

// EventFoo is "asd"
// asdasd
type EventFoo struct {
  Bar int `json:"bar"`
}

to

// EventFoo is "asd"
//
// asdasd
type EventFoo struct {
  Bar int `json:"bar"`
}

Alternatives Considered

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions