mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Another actions test (#889)
* Another actions test Signed-off-by: Chris Cummer <chriscummer@me.com> * Add BuildTest action Signed-off-by: Chris Cummer <chriscummer@me.com> * Remove lint check for the time being (so many issues) Signed-off-by: Chris Cummer <chriscummer@me.com> * Fix issues found by errcheck Signed-off-by: Chris Cummer <chriscummer@me.com> * Fix errors found by staticcheck Signed-off-by: Chris Cummer <chriscummer@me.com> * Fix issues found by goimports Signed-off-by: Chris Cummer <chriscummer@me.com> * Comment out the action for the time being Signed-off-by: Chris Cummer <chriscummer@me.com> * Fix shadowed variables Signed-off-by: Chris Cummer <chriscummer@me.com> * go mod tidy Signed-off-by: Chris Cummer <chriscummer@me.com> * Remove buildtest.yml Signed-off-by: Chris Cummer <chriscummer@me.com> * go mod tidy Signed-off-by: Chris Cummer <chriscummer@me.com>
This commit is contained in:
@@ -16,7 +16,6 @@ import (
|
||||
"os"
|
||||
"os/user"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/wtfutil/wtf/utils"
|
||||
"golang.org/x/oauth2"
|
||||
@@ -39,29 +38,25 @@ func (widget *Widget) Fetch() ([]*sheets.ValueRange, error) {
|
||||
}
|
||||
|
||||
config, err := google.ConfigFromJSON(b, "https://www.googleapis.com/auth/spreadsheets.readonly")
|
||||
|
||||
if err != nil {
|
||||
log.Fatalf("Unable to get config from JSON. %v", err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
client := getClient(ctx, config)
|
||||
|
||||
srv, err := sheets.NewService(context.Background(), option.WithHTTPClient(client))
|
||||
if err != nil {
|
||||
log.Fatalf("Unable to get create server. %v", err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
cells := utils.ToStrs(widget.settings.cellAddresses)
|
||||
addresses := strings.Join(cells[:], ";")
|
||||
|
||||
responses := make([]*sheets.ValueRange, len(cells))
|
||||
|
||||
for i := 0; i < len(cells); i++ {
|
||||
resp, err := srv.Spreadsheets.Values.Get(widget.settings.sheetID, cells[i]).Do()
|
||||
if err != nil {
|
||||
log.Fatalf("Error fetching cells %s", addresses)
|
||||
return nil, err
|
||||
resp, getErr := srv.Spreadsheets.Values.Get(widget.settings.sheetID, cells[i]).Do()
|
||||
if getErr != nil {
|
||||
return nil, getErr
|
||||
}
|
||||
responses[i] = resp
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user