From 270359c71e5a3749b04a09e970f57ad85bc52891 Mon Sep 17 00:00:00 2001
From: "Andrew E. Torda" <torda@zbh.uni-hamburg.de>
Date: Thu, 20 Jan 2022 18:07:51 +0100
Subject: [PATCH] formatting

---
 doc.go                  |  3 ++-
 main.go                 |  8 ++++----
 mc_work/mc_work.go      |  2 +-
 mc_work/mc_work_test.go | 25 ++++++++++++-------------
 mc_work/plot.go         |  3 ++-
 mc_work/set_suffix.go   |  6 +++---
 nothing_test.go         |  4 ++--
 7 files changed, 26 insertions(+), 25 deletions(-)

diff --git a/doc.go b/doc.go
index 94a0755..6a69ce7 100644
--- a/doc.go
+++ b/doc.go
@@ -7,7 +7,8 @@
 // where input_file is a set of name-value pairs. These are defined with defaults
 // in rdprm.go. At the moment, we have
 package main
-/* 
+
+/*
 	{"ini_temp", "20"},
 	{"final_temp", "1"},
 	{"n_step", "1000"},
diff --git a/main.go b/main.go
index 76a936f..e69a7cb 100644
--- a/main.go
+++ b/main.go
@@ -21,9 +21,9 @@ const (
 )
 
 func main() {
-	if err := mc_work.MyMain (); err != nil {
-		fmt.Fprintln (os.Stderr, err)
-		os.Exit (exitFailure)
+	if err := mc_work.MyMain(); err != nil {
+		fmt.Fprintln(os.Stderr, err)
+		os.Exit(exitFailure)
 	}
-	os.Exit (exitSuccess)
+	os.Exit(exitSuccess)
 }
diff --git a/mc_work/mc_work.go b/mc_work/mc_work.go
index 572fb9f..7b65f85 100644
--- a/mc_work/mc_work.go
+++ b/mc_work/mc_work.go
@@ -8,7 +8,7 @@ import (
 	"io"
 	"os"
 
-		"example.com/ackley_mc/ackley"
+	"example.com/ackley_mc/ackley"
 )
 
 type mcPrm struct {
diff --git a/mc_work/mc_work_test.go b/mc_work/mc_work_test.go
index 89b6067..0cf25cf 100644
--- a/mc_work/mc_work_test.go
+++ b/mc_work/mc_work_test.go
@@ -9,17 +9,16 @@ import (
 	"testing"
 )
 
-
 var tstTmpDir string
 
 func init() {
 	var err error
 	if tstTmpDir, err = os.MkdirTemp(".", "test_tmp*"); err != nil {
-		fmt.Fprintln (os.Stderr, "Failed to create temporary directory", tstTmpDir)
+		fmt.Fprintln(os.Stderr, "Failed to create temporary directory", tstTmpDir)
 		os.Exit(1)
 	}
 }
-		
+
 func TestErr(t *testing.T) {
 	rdrErr := strings.NewReader("\nrubbish")
 	if err := realmain(rdrErr); err == nil {
@@ -39,6 +38,7 @@ func TestTypo(t *testing.T) { // Make sure a typo in input does provoke an error
 		t.Fatal("line with typo should provoke error\n", err, "\nInput", sTypo)
 	}
 }
+
 type gentest struct{ params, basename string }
 
 var set1 = []gentest{
@@ -69,27 +69,26 @@ ini_temp 0.18
 final_temp 0.01
 x_ini 7,1,7
 n_step 100000`, "phasetrans"},
-    
 }
 
 // addTestPath makes some of the loops below a bit more readable
-func addTestPath (s string) string {
-	return tstTmpDir + string (os.PathSeparator) + s	
+func addTestPath(s string) string {
+	return tstTmpDir + string(os.PathSeparator) + s
 }
 
 // add OutNames uses the basename field and makes output names for
 // the value and x trajectory plot files and the csv file
-func addOutNames (s gentest) string {
+func addOutNames(s gentest) string {
 
 	ret := s.params
-	for _, ss := range []string {"xPltName", "fOutName"} {
+	for _, ss := range []string{"xPltName", "fOutName"} {
 		ret += "\n" + ss + " " + addTestPath(s.basename)
 	}
 	ret += "\nfPltName" + " " + addTestPath(s.basename) + "_fval"
 	return ret + "\n"
 }
 func Test1(t *testing.T) {
-	for _, s:= range set1 {
+	for _, s := range set1 {
 		instring := addOutNames(s)
 		if err := realmain(strings.NewReader(instring)); err != nil {
 			t.Fatal("set1 failed with\n", err, "\nInput:", s)
@@ -126,10 +125,10 @@ func TestSetSuffix(t *testing.T) {
 func TestRemoveQuotes(t *testing.T) {
 	var tdata = []struct {
 		in, out string
-	} {
+	}{
 		{"hello", "hello"},
 		{"", ""},
-		{`"`,  ""},
+		{`"`, ""},
 		{`""`, ""},
 		{`"""`, ""},
 		{`""a"`, "a"},
@@ -140,8 +139,8 @@ func TestRemoveQuotes(t *testing.T) {
 		{`a""`, "a"},
 	}
 	for _, ss := range tdata {
-		if out := RemoveQuotes (ss.in); out != ss.out {
-			t.Fatalf ("Wanted <%s>, got <%s>. Input was <%s>", ss.out, out, ss.in)
+		if out := RemoveQuotes(ss.in); out != ss.out {
+			t.Fatalf("Wanted <%s>, got <%s>. Input was <%s>", ss.out, out, ss.in)
 		}
 	}
 }
diff --git a/mc_work/plot.go b/mc_work/plot.go
index f38c9dd..4dc9d3c 100644
--- a/mc_work/plot.go
+++ b/mc_work/plot.go
@@ -40,6 +40,7 @@ func maketicks(axisDscrpt axticks.AxisDscrpt) []chart.Tick {
 	}
 	return t
 }
+
 // maketicks this version works, but usually leaves you wanting one tick more.
 /*func alt_maketicks(axisDscrpt axticks.AxisDscrpt, prcsn int) []chart.Tick {
 	xmin, xmax, delta, prcsn := axisDscrpt.Xmin, axisDscrpt.Xmax, axisDscrpt.Delta, axisDscrpt.Prcsn
@@ -112,7 +113,7 @@ func plotfWrt(cprm *cprm, fname string) error {
 
 	graph := chart.Chart{
 		Width: 800,
-		Title:  "cost function",
+		Title: "cost function",
 		Series: []chart.Series{
 			chart.ContinuousSeries{ // The function values
 				Name:    "cost",
diff --git a/mc_work/set_suffix.go b/mc_work/set_suffix.go
index 67c13c2..81fc9be 100644
--- a/mc_work/set_suffix.go
+++ b/mc_work/set_suffix.go
@@ -39,11 +39,11 @@ func setSuffix(fname, suffix string) (string, error) {
 // removeQuotes removes leading and trailing quotes from a string.
 // We do not check for single, unmatched quotes. If you want a file
 // called "fname you should use some other program.
-func removeQuotes (s string) string {
-	for ; len(s) > 0 && s[0] == '"'  ;{
+func removeQuotes(s string) string {
+	for len(s) > 0 && s[0] == '"' {
 		s = s[1:]
 	}
-	for ; len(s) > 0 && s[len(s)-1] == '"' ; {
+	for len(s) > 0 && s[len(s)-1] == '"' {
 		s = s[:len(s)-1]
 	}
 	return s
diff --git a/nothing_test.go b/nothing_test.go
index 9ae26fa..647dac4 100644
--- a/nothing_test.go
+++ b/nothing_test.go
@@ -6,8 +6,8 @@ import (
 	"testing"
 )
 
-func TestNot (t *testing.T) {
+func TestNot(t *testing.T) {
 	if false {
-		t.Fatalf ("banana")
+		t.Fatalf("banana")
 	}
 }
-- 
GitLab