fix: Go linter issues in v2 API
Some checks failed
Build and Release / Lint (push) Successful in 2m39s
Build and Release / Integration Tests (PostgreSQL) (push) Successful in 1m8s
Build and Release / Unit Tests (push) Failing after 2m41s
Build and Release / Build Binaries (amd64, linux) (push) Failing after 54s
Build and Release / Build Binaries (amd64, windows) (push) Failing after 57s
Build and Release / Build Binaries (amd64, darwin) (push) Failing after 1m19s
Build and Release / Build Binaries (arm64, linux) (push) Failing after 50s
Build and Release / Build Binaries (arm64, darwin) (push) Failing after 55s
Some checks failed
Build and Release / Lint (push) Successful in 2m39s
Build and Release / Integration Tests (PostgreSQL) (push) Successful in 1m8s
Build and Release / Unit Tests (push) Failing after 2m41s
Build and Release / Build Binaries (amd64, linux) (push) Failing after 54s
Build and Release / Build Binaries (amd64, windows) (push) Failing after 57s
Build and Release / Build Binaries (amd64, darwin) (push) Failing after 1m19s
Build and Release / Build Binaries (arm64, linux) (push) Failing after 50s
Build and Release / Build Binaries (arm64, darwin) (push) Failing after 55s
- Remove omitempty from nested struct fields in PagesConfigResponse - Remove unused ctx parameter from findUpdateAsset and convertToAPIRelease - Simplify nil check for release.Attachments (len() handles nil) - Use strings.EqualFold instead of strings.ToUpper for case-insensitive comparison 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
18bb922839
commit
212117f077
BIN
assets/256x256.png
Normal file
BIN
assets/256x256.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
@ -19,10 +19,10 @@ type PagesConfigResponse struct {
|
||||
PublicLanding bool `json:"public_landing"`
|
||||
Template string `json:"template"`
|
||||
Domain string `json:"domain,omitempty"`
|
||||
Branding pages_module.BrandingConfig `json:"branding,omitempty"`
|
||||
Hero pages_module.HeroConfig `json:"hero,omitempty"`
|
||||
SEO pages_module.SEOConfig `json:"seo,omitempty"`
|
||||
Footer pages_module.FooterConfig `json:"footer,omitempty"`
|
||||
Branding pages_module.BrandingConfig `json:"branding"`
|
||||
Hero pages_module.HeroConfig `json:"hero"`
|
||||
SEO pages_module.SEOConfig `json:"seo"`
|
||||
Footer pages_module.FooterConfig `json:"footer"`
|
||||
}
|
||||
|
||||
// PagesContentResponse represents the rendered content for a landing page
|
||||
|
||||
@ -150,7 +150,7 @@ func CheckAppUpdate(ctx *context.APIContext) {
|
||||
}
|
||||
|
||||
// Find the appropriate asset for this platform/arch
|
||||
downloadURL, platformInfo := findUpdateAsset(ctx, latestRelease, platform, arch)
|
||||
downloadURL, platformInfo := findUpdateAsset(latestRelease, platform, arch)
|
||||
if downloadURL == "" {
|
||||
// No compatible asset found
|
||||
ctx.Status(http.StatusNoContent)
|
||||
@ -169,8 +169,8 @@ func CheckAppUpdate(ctx *context.APIContext) {
|
||||
}
|
||||
|
||||
// findUpdateAsset finds the appropriate download asset for the given platform and architecture
|
||||
func findUpdateAsset(ctx *context.APIContext, release *repo_model.Release, platform, arch string) (string, *PlatformInfo) {
|
||||
if release.Attachments == nil || len(release.Attachments) == 0 {
|
||||
func findUpdateAsset(release *repo_model.Release, platform, arch string) (string, *PlatformInfo) {
|
||||
if len(release.Attachments) == 0 {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
@ -199,7 +199,7 @@ func findUpdateAsset(ctx *context.APIContext, release *repo_model.Release, platf
|
||||
// For Windows, also look for RELEASES file
|
||||
if platform == "windows" {
|
||||
for _, a := range release.Attachments {
|
||||
if strings.ToUpper(a.Name) == "RELEASES" {
|
||||
if strings.EqualFold(a.Name, "RELEASES") {
|
||||
platformInfo.ReleasesURL = fmt.Sprintf("%s%s/%s/releases/download/%s/%s",
|
||||
setting.AppURL,
|
||||
release.Repo.OwnerName,
|
||||
@ -346,7 +346,7 @@ func ListReleasesV2(ctx *context.APIContext) {
|
||||
// Convert to API format
|
||||
apiReleases := make([]*api.Release, 0, len(releases))
|
||||
for _, release := range releases {
|
||||
apiReleases = append(apiReleases, convertToAPIRelease(ctx, repo, release))
|
||||
apiReleases = append(apiReleases, convertToAPIRelease(repo, release))
|
||||
}
|
||||
|
||||
ctx.JSON(http.StatusOK, apiReleases)
|
||||
@ -388,7 +388,7 @@ func GetReleaseV2(ctx *context.APIContext) {
|
||||
return
|
||||
}
|
||||
|
||||
ctx.JSON(http.StatusOK, convertToAPIRelease(ctx, repo, release))
|
||||
ctx.JSON(http.StatusOK, convertToAPIRelease(repo, release))
|
||||
}
|
||||
|
||||
// GetLatestReleaseV2 gets the latest release
|
||||
@ -436,11 +436,11 @@ func GetLatestReleaseV2(ctx *context.APIContext) {
|
||||
return
|
||||
}
|
||||
|
||||
ctx.JSON(http.StatusOK, convertToAPIRelease(ctx, repo, release))
|
||||
ctx.JSON(http.StatusOK, convertToAPIRelease(repo, release))
|
||||
}
|
||||
|
||||
// convertToAPIRelease converts a repo_model.Release to api.Release
|
||||
func convertToAPIRelease(ctx *context.APIContext, repo *repo_model.Repository, release *repo_model.Release) *api.Release {
|
||||
func convertToAPIRelease(repo *repo_model.Repository, release *repo_model.Release) *api.Release {
|
||||
assets := make([]*api.Attachment, 0, len(release.Attachments))
|
||||
for _, attachment := range release.Attachments {
|
||||
assets = append(assets, &api.Attachment{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user