浏览代码

Updated ansi-to-go. Use []string. Remove go.sum.

Steve Thielemann 2 年之前
父节点
当前提交
d69ed53081
共有 3 个文件被更改,包括 7 次插入3 次删除
  1. 1 1
      Makefile
  2. 4 2
      ansi-to-go/ansi-to-go.go
  3. 2 0
      testdoor/go.mod

+ 1 - 1
Makefile

@@ -34,7 +34,7 @@ space-ace/space.go: space.ans
 	./ansi-to-go.py main space.ans > space-ace/space.go
 
 testdoor/testdoor: testdoor/art.go testdoor/fonts.go testdoor/rgfont.go testdoor/*.go door/*.go
-	cd testdoor; go build
+	cd testdoor; GOOS=linux GOARCH=amd64 go build
 
 testdoor/testdoor.exe: testdoor/art.go testdoor/fonts.go testdoor/rgfont.go testdoor/*.go door/*.go
 	cd testdoor; GOOS=windows GOARCH=amd64 go build

+ 4 - 2
ansi-to-go/ansi-to-go.go

@@ -64,9 +64,11 @@ func readfile(filename string) {
 	// Ok, is what we have usable, or did it mangle up our Latin1 text?
 	// hexout(lines[0])
 
-	fmt.Printf("func ANSI%s() [%d]string {\n", strings.Title(basename), len(lines))
+	// fmt.Printf("func ANSI%s() [%d]string {\n", strings.Title(basename), len(lines))
+	fmt.Printf("func ANSI%s() []string {\n", strings.Title(basename))
 	// insert CP437_to_Unicode in here, if needed.
-	fmt.Printf("  data := [%d]string {\n", len(lines))
+	// fmt.Printf("  data := [%d]string {\n", len(lines))
+	fmt.Print("  data := []string {\n")
 	for _, line := range lines {
 		fmt.Printf("    \"%s\",\n", repr_line(line))
 	}

+ 2 - 0
testdoor/go.mod

@@ -5,3 +5,5 @@ go 1.17
 replace red-green/door => ../door
 
 require red-green/door v0.0.0-00010101000000-000000000000
+
+require github.com/mitchellh/go-wordwrap v1.0.1 // indirect