Skip to content

Commit

Permalink
Merge pull request #127 from testwill/fmt
Browse files Browse the repository at this point in the history
chore: unnecessary use of fmt.Sprintf
  • Loading branch information
rcoreilly authored Dec 8, 2023
2 parents 4d289bd + c4e63ce commit 7913bd8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
3 changes: 1 addition & 2 deletions netparams/io.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ package netparams
import (
"bytes"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"log"
Expand Down Expand Up @@ -68,7 +67,7 @@ func (pr *Sets) SaveTOML(filename gi.FileName) error {

// WriteGoCode writes params to corresponding Go initializer code.
func (pr *Sets) WriteGoCode(w io.Writer, depth int) {
w.Write([]byte(fmt.Sprintf("netparams.Sets{\n")))
w.Write([]byte("netparams.Sets{\n"))
depth++
for nm, st := range *pr {
w.Write(indent.TabBytes(depth))
Expand Down
10 changes: 5 additions & 5 deletions params/io.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func (pr *Params) SaveTOML(filename gi.FileName) error {

// WriteGoCode writes params to corresponding Go initializer code.
func (pr *Params) WriteGoCode(w io.Writer, depth int) {
w.Write([]byte(fmt.Sprintf("params.Params{\n")))
w.Write([]byte("params.Params{\n"))
depth++
paths := make([]string, len(*pr)) // alpha-sort paths for consistent output
ctr := 0
Expand Down Expand Up @@ -148,7 +148,7 @@ func (pr *Hypers) SaveTOML(filename gi.FileName) error {

// WriteGoCode writes hypers to corresponding Go initializer code.
func (pr *Hypers) WriteGoCode(w io.Writer, depth int) {
w.Write([]byte(fmt.Sprintf("params.Hypers{\n")))
w.Write([]byte("params.Hypers{\n"))
depth++
paths := maps.Keys(*pr)
sort.StringSlice(paths).Sort()
Expand Down Expand Up @@ -300,7 +300,7 @@ func (pr *Sheet) SaveTOML(filename gi.FileName) error {

// WriteGoCode writes params to corresponding Go initializer code.
func (pr *Sheet) WriteGoCode(w io.Writer, depth int) {
w.Write([]byte(fmt.Sprintf("{\n")))
w.Write([]byte("{\n"))
depth++
for _, pv := range *pr {
w.Write(indent.TabBytes(depth))
Expand Down Expand Up @@ -374,7 +374,7 @@ func (pr *Sheets) SaveTOML(filename gi.FileName) error {

// WriteGoCode writes params to corresponding Go initializer code.
func (pr *Sheets) WriteGoCode(w io.Writer, depth int) {
w.Write([]byte(fmt.Sprintf("params.Sheets{\n")))
w.Write([]byte("params.Sheets{\n"))
depth++
nms := make([]string, len(*pr)) // alpha-sort names for consistent output
ctr := 0
Expand Down Expand Up @@ -498,7 +498,7 @@ func (pr *Sets) SaveTOML(filename gi.FileName) error {

// WriteGoCode writes params to corresponding Go initializer code.
func (pr *Sets) WriteGoCode(w io.Writer, depth int) {
w.Write([]byte(fmt.Sprintf("params.Sets{\n")))
w.Write([]byte("params.Sets{\n"))
depth++
for nm, st := range *pr {
w.Write(indent.TabBytes(depth))
Expand Down

0 comments on commit 7913bd8

Please sign in to comment.