Skip to content

Commit

Permalink
style: style all project
Browse files Browse the repository at this point in the history
  • Loading branch information
textworld committed Dec 4, 2023
1 parent 9ba3842 commit ad38517
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 11 deletions.
1 change: 1 addition & 0 deletions handler/admin/application_password.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package admin

import (
"errors"

"github.com/gin-gonic/gin"
"github.com/go-playground/validator/v10"
"github.com/go-sonic/sonic/handler/trans"
Expand Down
11 changes: 5 additions & 6 deletions handler/content/wp/post.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,10 @@ func parsePostParam(ctx *gin.Context) (*param.Post, error) {
log.CtxInfo(ctx, "wpPost: "+string(bytes))

return convertToPostParam(&wpPost)

}

func convertToPostParam(wpPost *param.WpPost) (*param.Post, error) {
var paramPostStatus = sonicconst.PostStatusPublished
paramPostStatus := sonicconst.PostStatusPublished
if strings.ToLower(wpPost.Status) == "draft" {
paramPostStatus = sonicconst.PostStatusDraft
}
Expand Down Expand Up @@ -168,9 +167,9 @@ func convertToPostParam(wpPost *param.WpPost) (*param.Post, error) {

func convertToWpPost(postEntity *entity.Post) *wp.PostDTO {
timeFormat := time.RFC3339
var wpStatus = "publish"
var wpCommentStatus = "open"
var wpContent = make(map[string]interface{})
wpStatus := "publish"
wpCommentStatus := "open"
wpContent := make(map[string]interface{})

if postEntity.Status == sonicconst.PostStatusDraft {
wpStatus = "draft"
Expand All @@ -183,7 +182,7 @@ func convertToWpPost(postEntity *entity.Post) *wp.PostDTO {
wpContent["rendered"] = postEntity.OriginalContent
wpContent["protected"] = false

var postDTO = &wp.PostDTO{
postDTO := &wp.PostDTO{
Date: postEntity.CreateTime.Format(timeFormat),
DateGmt: postEntity.CreateTime.UTC().Format(timeFormat),
GUID: nil,
Expand Down
3 changes: 2 additions & 1 deletion handler/content/wp/tag.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package wp

import (
"strings"

"github.com/gin-gonic/gin"

Check failure on line 6 in handler/content/wp/tag.go

View workflow job for this annotation

GitHub Actions / lint

File is not `goimports`-ed with -local github.com/go-sonic/sonic (goimports)
"github.com/go-sonic/sonic/model/dto/wp"
"github.com/go-sonic/sonic/model/entity"
"github.com/go-sonic/sonic/model/param"
"github.com/go-sonic/sonic/service"
"github.com/go-sonic/sonic/util/xerr"
"strings"
)

type TagHandler struct {
Expand Down
4 changes: 1 addition & 3 deletions handler/middleware/application_password.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ import (
"github.com/go-sonic/sonic/service"
)

var (
basicAuthRegexp = regexp.MustCompile(`^Basic [a-z\\d/+]*={0,2}`)
)
var basicAuthRegexp = regexp.MustCompile(`^Basic [a-z\\d/+]*={0,2}`)

type ApplicationPasswordMiddleware struct {
PasswordService service.ApplicationPasswordService
Expand Down
1 change: 1 addition & 0 deletions service/application_password.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package service

import (
"context"

"github.com/go-sonic/sonic/model/dto"
"github.com/go-sonic/sonic/model/entity"
"github.com/go-sonic/sonic/model/param"
Expand Down
1 change: 0 additions & 1 deletion service/impl/application_password.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ func (a *applicationPasswordServiceImpl) Update(ctx context.Context, entityID in
LastActivateIP: ip,
LastActivateTime: &now,
})

if err != nil {
return WrapDBErr(err)
}
Expand Down

0 comments on commit ad38517

Please sign in to comment.