Skip to content

Go 1.19 format #20758

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Aug 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ GOFUMPT_PACKAGE ?= mvdan.cc/[email protected]
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/cmd/[email protected]
GXZ_PAGAGE ?= github.com/ulikunitz/xz/cmd/[email protected]
MISSPELL_PACKAGE ?= github.com/client9/misspell/cmd/[email protected]
SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/swagger@v0.29.0
SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/swagger@v0.30.0
XGO_PACKAGE ?= src.techknowlogick.com/xgo@latest

DOCKER_IMAGE ?= gitea/gitea
Expand Down
2 changes: 1 addition & 1 deletion assets/emoji.json

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions build/generate-emoji.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,7 @@ const hdr = `

package emoji

// Code generated by gen.go. DO NOT EDIT.
// Code generated by build/generate-emoji.go. DO NOT EDIT.
// Sourced from %s
//
var GemojiData = %#v
`
1 change: 1 addition & 0 deletions modules/avatar/identicon/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ func b1(img *image.Paletted, x, y, size, angle int) {
}

// a small block
//
// ----------
// | |
// | #### |
Expand Down
2 changes: 1 addition & 1 deletion modules/csv/csv_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ func TestGuessDelimiter(t *testing.T) {
},
// case 3 - tab delimited
{
csv: "1 2",
csv: "1\t2",
expectedDelimiter: '\t',
},
// case 4 - pipe delimited
Expand Down
629 changes: 334 additions & 295 deletions modules/emoji/emoji_data.go

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions modules/git/foreachref/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ func NewParser(r io.Reader, format Format) *Parser {
// It could, for example return something like:
//
// { "objecttype": "tag", "refname:short": "v1.16.4", "object": "f460b7543ed500e49c133c2cd85c8c55ee9dbe27" }
//
func (p *Parser) Next() map[string]string {
if !p.scanner.Scan() {
return nil
Expand All @@ -90,7 +89,6 @@ func (p *Parser) Err() error {
// parseRef parses out all key-value pairs from a single reference block, such as
//
// "objecttype tag\0refname:short v1.16.4\0object f460b7543ed500e49c133c2cd85c8c55ee9dbe27"
//
func (p *Parser) parseRef(refBlock string) (map[string]string, error) {
if refBlock == "" {
// must be at EOF
Expand Down
2 changes: 2 additions & 0 deletions modules/git/signature_gogit.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ import (
type Signature = object.Signature

// Helper to get a signature from the commit line, which looks like these:
//
// author Patrick Gundlach <[email protected]> 1378823654 +0200
// author Patrick Gundlach <[email protected]> Thu, 07 Apr 2005 22:13:13 +0200
//
// but without the "author " at the beginning (this method should)
// be used for author and committer.
//
Expand Down
2 changes: 2 additions & 0 deletions modules/git/signature_nogogit.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ func (s *Signature) Decode(b []byte) {
}

// Helper to get a signature from the commit line, which looks like these:
//
// author Patrick Gundlach <[email protected]> 1378823654 +0200
// author Patrick Gundlach <[email protected]> Thu, 07 Apr 2005 22:13:13 +0200
//
// but without the "author " at the beginning (this method should)
// be used for author and committer.
func newSignatureFromCommitline(line []byte) (sig *Signature, err error) {
Expand Down
1 change: 1 addition & 0 deletions modules/log/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ func NewFileLogger() LoggerProvider {

// Init file logger with json config.
// config like:
//
// {
// "filename":"log/gogs.log",
// "maxsize":1<<30,
Expand Down
1 change: 1 addition & 0 deletions modules/log/smtp.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ func NewSMTPLogger() LoggerProvider {

// Init smtp writer with json config.
// config like:
//
// {
// "Username":"[email protected]",
// "password:"password",
Expand Down
Whitespace-only changes.
2 changes: 1 addition & 1 deletion modules/pprof/pprof.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func DumpMemProfileForUsername(pprofDataPath, username string) error {
}

// DumpCPUProfileForUsername dumps a CPU profile at pprofDataPath as cpuprofile_<username>_<temporary id>
// it returns the stop function which stops, writes and closes the CPU profile file
// the stop function it returns stops, writes and closes the CPU profile file
func DumpCPUProfileForUsername(pprofDataPath, username string) (func(), error) {
f, err := os.CreateTemp(pprofDataPath, fmt.Sprintf("cpuprofile_%s_", username))
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion modules/util/string.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ func isSnakeCaseLowerOrNumber(c byte) bool {
// ToSnakeCase convert the input string to snake_case format.
//
// Some samples.
//
// "FirstName" => "first_name"
// "HTTPServer" => "http_server"
// "NoHTTPS" => "no_https"
// "GO_PATH" => "go_path"
// "GO PATH" => "go_path" // space is converted to underscore.
// "GO-PATH" => "go_path" // hyphen is converted to underscore.
//
func ToSnakeCase(input string) string {
if len(input) == 0 {
return ""
Expand Down
1 change: 0 additions & 1 deletion routers/api/v1/activitypub/person.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ func PersonInbox(ctx *context.APIContext) {
// type: string
// required: true
// responses:
// responses:
// "204":
// "$ref": "#/responses/empty"

Expand Down
Empty file modified routers/api/v1/api.go
Whitespace-only changes.
4 changes: 2 additions & 2 deletions routers/api/v1/repo/git_ref.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func GetGitAllRefs(ctx *context.APIContext) {
// required: true
// responses:
// "200":
// "$ref": "#/responses/Reference"
// # "$ref": "#/responses/Reference" TODO: swagger doesnt support different output formats by ref
// "$ref": "#/responses/ReferenceList"
// "404":
// "$ref": "#/responses/notFound"
Expand Down Expand Up @@ -67,7 +67,7 @@ func GetGitRefs(ctx *context.APIContext) {
// required: true
// responses:
// "200":
// "$ref": "#/responses/Reference"
// # "$ref": "#/responses/Reference" TODO: swagger doesnt support different output formats by ref
// "$ref": "#/responses/ReferenceList"
// "404":
// "$ref": "#/responses/notFound"
Expand Down
5 changes: 2 additions & 3 deletions routers/api/v1/repo/issue_tracked_time.go
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,8 @@ func ListMyTrackedTimes(ctx *context.APIContext) {
// swagger:operation GET /user/times user userCurrentTrackedTimes
// ---
// summary: List the current user's tracked times
// produces:
// - application/json
// parameters:
// - name: page
// in: query
Expand All @@ -575,9 +577,6 @@ func ListMyTrackedTimes(ctx *context.APIContext) {
// in: query
// description: page size of results
// type: integer
// produces:
// - application/json
// parameters:
// - name: since
// in: query
// description: Only show times updated after the given time. This is a timestamp in RFC 3339 format
Expand Down
1 change: 0 additions & 1 deletion routers/api/v1/repo/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,6 @@ func Edit(ctx *context.APIContext) {
// description: name of the repo to edit
// type: string
// required: true
// required: true
// - name: body
// in: body
// description: "Properties of a repo that you can edit"
Expand Down
5 changes: 0 additions & 5 deletions routers/api/v1/user/email.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,6 @@ func AddEmail(ctx *context.APIContext) {
// produces:
// - application/json
// parameters:
// - name: options
// in: body
// schema:
// "$ref": "#/definitions/CreateEmailOption"
// parameters:
// - name: body
// in: body
// schema:
Expand Down
1 change: 1 addition & 0 deletions services/migrations/gitea_downloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ type GiteaDownloader struct {
}

// NewGiteaDownloader creates a gitea Downloader via gitea API
//
// Use either a username/password or personal token. token is preferred
// Note: Public access only allows very basic access
func NewGiteaDownloader(ctx context.Context, baseURL, repoPath, username, password, token string) (*GiteaDownloader, error) {
Expand Down
2 changes: 2 additions & 0 deletions services/migrations/gitlab.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ type GitlabDownloader struct {
}

// NewGitlabDownloader creates a gitlab Downloader via gitlab API
//
// Use either a username/password, personal token entered into the username field, or anonymous/public access
// Note: Public access only allows very basic access
func NewGitlabDownloader(ctx context.Context, baseURL, repoPath, username, password, token string) (*GitlabDownloader, error) {
Expand Down Expand Up @@ -353,6 +354,7 @@ type gitlabIssueContext struct {
}

// GetIssues returns issues according start and limit
//
// Note: issue label description and colors are not supported by the go-gitlab library at this time
func (g *GitlabDownloader) GetIssues(page, perPage int) ([]*base.Issue, bool, error) {
state := "all"
Expand Down
14 changes: 12 additions & 2 deletions templates/swagger/v1_json.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -12699,6 +12699,18 @@
"summary": "List the current user's tracked times",
"operationId": "userCurrentTrackedTimes",
"parameters": [
{
"type": "integer",
"description": "page number of results to return (1-based)",
"name": "page",
"in": "query"
},
{
"type": "integer",
"description": "page size of results",
"name": "limit",
"in": "query"
},
{
"type": "string",
"format": "date-time",
Expand Down Expand Up @@ -15936,7 +15948,6 @@
"$ref": "#/definitions/FileCommitResponse"
},
"content": {
"type": "object",
"x-go-name": "Content"
},
"verification": {
Expand Down Expand Up @@ -18933,7 +18944,6 @@
"x-go-name": "Ignored"
},
"reason": {
"type": "object",
"x-go-name": "Reason"
},
"repository_url": {
Expand Down