mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Formatting fixes
This commit is contained in:
parent
c4210f7551
commit
0b1ec96545
@ -81,11 +81,10 @@ func CreateConfigFile() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If the file is empty, write to it
|
// If the file is empty, write to it
|
||||||
file, err := os.Stat(filePath)
|
file, _ := os.Stat(filePath)
|
||||||
|
|
||||||
if file.Size() == 0 {
|
if file.Size() == 0 {
|
||||||
err = ioutil.WriteFile(filePath, []byte(simpleConfig), 0644)
|
if ioutil.WriteFile(filePath, []byte(simpleConfig), 0644) != nil {
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -73,15 +73,15 @@ func contentFrom(positions *AllPositionsResponse) string {
|
|||||||
const magic = "edtopjhgn2345piuty89whqejfiobh89-2q453"
|
const magic = "edtopjhgn2345piuty89whqejfiobh89-2q453"
|
||||||
|
|
||||||
type Position struct {
|
type Position struct {
|
||||||
Coin string `json:coin`
|
Coin string `json:"coin"`
|
||||||
LastPriceFiat float32 `json:lastPriceFiat`
|
LastPriceFiat float32 `json:"lastPriceFiat"`
|
||||||
TwentyFourHourPercentChangeFiat float32 `json:twentyFourHourPercentChangeFiat`
|
TwentyFourHourPercentChangeFiat float32 `json:"twentyFourHourPercentChangeFiat"`
|
||||||
Quantity float32 `json:quantity`
|
Quantity float32 `json:"quantity"`
|
||||||
HoldingValueFiat float32 `json:holdingValueFiat`
|
HoldingValueFiat float32 `json:"holdingValueFiat"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type AllPositionsResponse struct {
|
type AllPositionsResponse struct {
|
||||||
PositionList []Position `json:positionList`
|
PositionList []Position `json:"positionList"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func MakeApiRequest(token string, method string) ([]byte, error) {
|
func MakeApiRequest(token string, method string) ([]byte, error) {
|
||||||
|
@ -23,7 +23,7 @@ func Create(jenkinsURL string, username string, apiKey string) (*View, error) {
|
|||||||
}
|
}
|
||||||
jenkinsAPIURL := parsedJenkinsURL.ResolveReference(parsedSuffix)
|
jenkinsAPIURL := parsedJenkinsURL.ResolveReference(parsedSuffix)
|
||||||
|
|
||||||
req, err := http.NewRequest("GET", jenkinsAPIURL.String(), nil)
|
req, _ := http.NewRequest("GET", jenkinsAPIURL.String(), nil)
|
||||||
req.SetBasicAuth(username, apiKey)
|
req.SetBasicAuth(username, apiKey)
|
||||||
|
|
||||||
httpClient := &http.Client{}
|
httpClient := &http.Client{}
|
||||||
@ -45,7 +45,6 @@ func ensureLastSlash(URL string) string {
|
|||||||
|
|
||||||
/* -------------------- Unexported Functions -------------------- */
|
/* -------------------- Unexported Functions -------------------- */
|
||||||
|
|
||||||
|
|
||||||
func parseJson(obj interface{}, text io.Reader) {
|
func parseJson(obj interface{}, text io.Reader) {
|
||||||
jsonStream, err := ioutil.ReadAll(text)
|
jsonStream, err := ioutil.ReadAll(text)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -6,5 +6,5 @@ type View struct {
|
|||||||
Jobs []Job `json:"jobs"`
|
Jobs []Job `json:"jobs"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Property []string `json:"property"`
|
Property []string `json:"property"`
|
||||||
url string `json:"url"`
|
Url string `json:"url"`
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user