-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add a net based fallback for go install
- Loading branch information
Showing
5 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,8 @@ builds: | |
- amd64 | ||
- arm64 | ||
flags: -trimpath | ||
tags: | ||
- embed | ||
|
||
archives: | ||
- format: tar.gz | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
//go:build embed | ||
|
||
package webui | ||
|
||
import ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
//go:build !embed | ||
|
||
package webui | ||
|
||
import ( | ||
"fmt" | ||
gsv "github.com/Zxilly/go-size-analyzer" | ||
"github.com/Zxilly/go-size-analyzer/internal/utils" | ||
"io" | ||
"log/slog" | ||
"net/http" | ||
) | ||
|
||
var BaseUrl = fmt.Sprintf("https://github.com/Zxilly/go-size-analyzer/releases/download/ui-v%d/index.html", gsv.GetStaticVersion()) | ||
|
||
func GetTemplate() string { | ||
slog.Info("Downloading template") | ||
resp, err := http.Get(BaseUrl) | ||
if err != nil { | ||
utils.FatalError(err) | ||
} | ||
defer func(Body io.ReadCloser) { | ||
_ = Body.Close() | ||
}(resp.Body) | ||
|
||
body, err := io.ReadAll(resp.Body) | ||
if err != nil { | ||
utils.FatalError(err) | ||
} | ||
|
||
return string(body) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters