mirror of
				https://github.com/taigrr/wtf
				synced 2025-01-18 04:03:14 -08:00 
			
		
		
		
	Make CI happy
This commit is contained in:
		
							parent
							
								
									7f05fbcda5
								
							
						
					
					
						commit
						6908e744e1
					
				| @ -1,9 +1,9 @@ | ||||
| package uptimerobot | ||||
| 
 | ||||
| import ( | ||||
| 	"fmt" | ||||
| 	"errors" | ||||
| 	"encoding/json" | ||||
| 	"errors" | ||||
| 	"fmt" | ||||
| 	"io/ioutil" | ||||
| 	"net/http" | ||||
| 	"net/url" | ||||
| @ -92,11 +92,9 @@ func (widget *Widget) contentFrom(monitors []Monitor) string { | ||||
| 		switch monitor.State { | ||||
| 		case 2: | ||||
| 			prefix += "[green] + " | ||||
| 			break | ||||
| 		case 8: | ||||
| 		case 9: | ||||
| 			prefix += "[red] - " | ||||
| 			break | ||||
| 		default: | ||||
| 			prefix += "[yellow] ~ " | ||||
| 		} | ||||
| @ -138,19 +136,22 @@ func (widget *Widget) getMonitors() ([]Monitor, error) { | ||||
| 
 | ||||
| 	// First pass to read the status | ||||
| 	c := make(map[string]json.RawMessage) | ||||
| 	json.Unmarshal([]byte(body), &c) | ||||
| 	err_j1 := json.Unmarshal([]byte(body), &c) | ||||
| 
 | ||||
| 	stat := string(c["stat"]) | ||||
| 	if stat != `"ok"` { | ||||
| 	if err_j1 != nil { | ||||
| 		return nil, err_j1 | ||||
| 	} | ||||
| 
 | ||||
| 	if string(c["stat"]) != `"ok"` { | ||||
| 		return nil, errors.New(string(body)) | ||||
| 	} | ||||
| 
 | ||||
| 	// Second pass to get the actual info | ||||
| 	var monitors []Monitor | ||||
| 	err_j := json.Unmarshal(c["monitors"], &monitors) | ||||
| 	err_j2 := json.Unmarshal(c["monitors"], &monitors) | ||||
| 
 | ||||
| 	if err_j != nil { | ||||
| 		return nil, err_j | ||||
| 	if err_j2 != nil { | ||||
| 		return nil, err_j2 | ||||
| 	} | ||||
| 
 | ||||
| 	return monitors, nil | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user