about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2021-12-18T13·03+0300
committertazjin <mail@tazj.in>2021-12-19T18·05+0000
commit562236085b79b3fe793d9f02fdcbba9480c6a5ee (patch)
tree501e61075c5e53caaa81b55ce8d1fb7659a32858
parentd7bf4f07c98694aafa2acd78eba1871b769c61bd (diff)
style: format all Go code r/3311
The code in //users/wpcarro/tools/monzo_ynab/ynab/client.go was not
valid Go and has been commented out.

Change-Id: Icb4003607f30294dcbf60132eb7722702c7f0d84
Reviewed-on: https://cl.tvl.fyi/c/depot/+/4400
Tested-by: BuildkiteCI
Reviewed-by: wpcarro <wpcarro@gmail.com>
Reviewed-by: Profpatsch <mail@profpatsch.de>
-rw-r--r--ops/kontemplate/context/context_test.go8
-rw-r--r--ops/kontemplate/templater/templater_test.go2
-rw-r--r--users/Profpatsch/struct-edit/main.go36
-rw-r--r--users/wpcarro/tools/monzo_ynab/main.go10
-rw-r--r--users/wpcarro/tools/monzo_ynab/ynab/client.go36
5 files changed, 46 insertions, 46 deletions
diff --git a/ops/kontemplate/context/context_test.go b/ops/kontemplate/context/context_test.go
index 7ecd9d587d..471eb246cf 100644
--- a/ops/kontemplate/context/context_test.go
+++ b/ops/kontemplate/context/context_test.go
@@ -333,15 +333,15 @@ func TestSetInvalidVariablesFromArguments(t *testing.T) {
 // This test ensures that variables are merged in the correct order.
 // Please consult the test data in `testdata/merging`.
 func TestValueMergePrecedence(t *testing.T) {
-	cliVars:= []string{"cliVar=cliVar"}
+	cliVars := []string{"cliVar=cliVar"}
 	ctx, _ := LoadContext("testdata/merging/context.yaml", &cliVars)
 
 	expected := map[string]interface{}{
 		"defaultVar": "defaultVar",
-		"importVar": "importVar",
-		"globalVar": "globalVar",
+		"importVar":  "importVar",
+		"globalVar":  "globalVar",
 		"includeVar": "includeVar",
-		"cliVar": "cliVar",
+		"cliVar":     "cliVar",
 	}
 
 	result := ctx.ResourceSets[0].Values
diff --git a/ops/kontemplate/templater/templater_test.go b/ops/kontemplate/templater/templater_test.go
index c20858c203..9d9fc8d1ff 100644
--- a/ops/kontemplate/templater/templater_test.go
+++ b/ops/kontemplate/templater/templater_test.go
@@ -185,7 +185,7 @@ func TestInsertTemplateFunction(t *testing.T) {
 	resourceSet := context.ResourceSet{
 		Path: "testdata",
 		Values: map[string]interface{}{
-			"testName":        "TestInsertTemplateFunction",
+			"testName": "TestInsertTemplateFunction",
 		},
 	}
 
diff --git a/users/Profpatsch/struct-edit/main.go b/users/Profpatsch/struct-edit/main.go
index 7e43074266..c1a7013385 100644
--- a/users/Profpatsch/struct-edit/main.go
+++ b/users/Profpatsch/struct-edit/main.go
@@ -5,8 +5,8 @@ import (
 	"fmt"
 	"log"
 	"os"
-	"strings"
 	"sort"
+	"strings"
 
 	tea "github.com/charmbracelet/bubbletea"
 	lipgloss "github.com/charmbracelet/lipgloss"
@@ -16,8 +16,8 @@ import (
 
 // Keeps the full data structure and a path that indexes our current position into it.
 type model struct {
-	path          []index
-	data          val
+	path []index
+	data val
 }
 
 // an index into a value, uint for lists and string for maps.
@@ -103,17 +103,17 @@ func makeVal(i interface{}) val {
 	switch i := i.(type) {
 	case string:
 		v = val{
-			tag: tagString,
+			tag:        tagString,
 			last_index: index(nil),
-			doc: "",
-			val: &i,
+			doc:        "",
+			val:        &i,
 		}
 	case float64:
 		v = val{
-			tag: tagFloat,
+			tag:        tagFloat,
 			last_index: index(nil),
-			doc: "",
-			val: &i,
+			doc:        "",
+			val:        &i,
 		}
 	case []interface{}:
 		ls := []val{}
@@ -121,10 +121,10 @@ func makeVal(i interface{}) val {
 			ls = append(ls, makeVal(i))
 		}
 		v = val{
-			tag: tagList,
+			tag:        tagList,
 			last_index: pos1Inner(tagList, &ls),
-			doc: "",
-			val: &ls,
+			doc:        "",
+			val:        &ls,
 		}
 	case map[string]interface{}:
 		ls := map[string]val{}
@@ -132,10 +132,10 @@ func makeVal(i interface{}) val {
 			ls[k] = makeVal(i)
 		}
 		v = val{
-			tag: tagMap,
+			tag:        tagMap,
 			last_index: pos1Inner(tagMap, &ls),
-			doc: "",
-			val: &ls,
+			doc:        "",
+			val:        &ls,
 		}
 	default:
 		log.Fatalf("makeVal: cannot read json of type %T", i)
@@ -245,7 +245,7 @@ func walk(data *val, path []index) (*val, bool, error) {
 				if a, ok := m[p]; ok {
 					res = &a
 				} else {
-				  return nil, false, fmt.Errorf("index %s not in map %s", p, atPath(i))
+					return nil, false, fmt.Errorf("index %s not in map %s", p, atPath(i))
 				}
 			default:
 				return nil, false, fmt.Errorf("not a map index %v %s", p, atPath(i))
@@ -343,8 +343,8 @@ func (m model) Init() tea.Cmd {
 func initialModel(v interface{}) model {
 	val := makeVal(v)
 	return model{
-		path:          []index{},
-		data:          val,
+		path: []index{},
+		data: val,
 	}
 }
 
diff --git a/users/wpcarro/tools/monzo_ynab/main.go b/users/wpcarro/tools/monzo_ynab/main.go
index f40c70ce27..bf37071381 100644
--- a/users/wpcarro/tools/monzo_ynab/main.go
+++ b/users/wpcarro/tools/monzo_ynab/main.go
@@ -10,8 +10,8 @@
 package main
 
 import (
-	"os"
 	"monzoSerde"
+	"os"
 )
 
 var (
@@ -25,10 +25,10 @@ var (
 // Convert a Monzo transaction struct, `tx`, into a YNAB transaction struct.
 func toYnab(tx monzoSerde.Transaction) ynabSerde.Transaction {
 	return ynabSerde.Transaction{
-		Id: tx.Id,
-		Date: tx.Created,
-		Amount: tx.Amount,
-		Memo: tx.Notes,
+		Id:        tx.Id,
+		Date:      tx.Created,
+		Amount:    tx.Amount,
+		Memo:      tx.Notes,
 		AccountId: ynabAccountID,
 	}
 }
diff --git a/users/wpcarro/tools/monzo_ynab/ynab/client.go b/users/wpcarro/tools/monzo_ynab/ynab/client.go
index 0492b9071a..b3e9930f62 100644
--- a/users/wpcarro/tools/monzo_ynab/ynab/client.go
+++ b/users/wpcarro/tools/monzo_ynab/ynab/client.go
@@ -4,21 +4,21 @@ import (
 	"serde"
 )
 
-// See requests.txt for more details.
-func PostTransactions(accountID string, txs []serde.Transaction{}) error {
-	return map[string]string{
-		"transactions": [
-			{
-				"account_id": accountID,
-					"date": "2019-12-30",
-					"amount": 10000,
-					"payee_name": "Richard Stallman",
-					"memo": "Not so free software after all...",
-					"cleared": "cleared",
-					"approved": true,
-					"flag_color": "red",
-					"import_id": "xyz-123"
-			}
-		]
-	}
-}
+// // See requests.txt for more details.
+// func PostTransactions(accountID string, txs []serde.Transaction{}) error {
+// 	return map[string]string{
+// 		"transactions": [
+// 			{
+// 				"account_id": accountID,
+// 					"date": "2019-12-30",
+// 					"amount": 10000,
+// 					"payee_name": "Richard Stallman",
+// 					"memo": "Not so free software after all...",
+// 					"cleared": "cleared",
+// 					"approved": true,
+// 					"flag_color": "red",
+// 					"import_id": "xyz-123"
+// 			}
+// 		]
+// 	}
+// }