Thanks
I've read the official tutorial and your create-module docs.
They help, but I am still having issues getting this to hang together.
I got the treesort example to work.
Now I'm creating a new module, in a new subdirectory of my repositories
and I've done the go mod init
I have three go source files in the directory and the generated go.mod file
goprorename.go is what will eventually be a module/library of nice code.
goprorename_test.go is the test driver. Each of these two files are "package goprorename"
in the source.
main.go is a trivial file to run in the shell, creating an executable, probably named main.exe
that can accept shell arguments and call the nice code methods and functions.
I can't get the automatic compilation to work. i can't get testing to work. I can't get
the main/main.exe created.
Here are the contents of the go.mod and the top lines of each of the three go source files.
It has to be someting trivial that I am doing wrong or missing.
Thanks
Pat
pfarrell@Alien15:~/whome/sandbox/gows/goprorename$ head -n 15 go.mod
module
github.com/pfarrell51/gows/goprorenamego 1.19
pfarrell@Alien15:~/whome/sandbox/gows/goprorename$ head -n 15 goprorename.go
// rename files created by a GoPro into a single, sensible
// ordering of files so that the order is obvious for easy processing
// by other utulities such as RaceRender
//
// goPro naming conventions:
https://community.gopro.com/s/article/GoPro-Camera-File-Naming-Convention?language=en_USpackage goprorename
import (
"fmt"
"io/fs"
"regexp"
"strings"
)
pfarrell@Alien15:~/whome/sandbox/gows/goprorename$ head -n 15 goprorename_test.go
// test driver for gopro rename utility
package goprorename
import (
"fstest"
"testing"
)
func TestProcessFile(t *testing.T) {
fsys := fstest.MapFS{
"file.go": {},
"subfolder/subfolder.go": {},
"subfolder2/another.go": {},
"subfolder2/file.go": {},
pfarrell@Alien15:~/whome/sandbox/gows/goprorename$
pfarrell@Alien15:~/whome/sandbox/gows/goprorename$ head -n 15 main.go
// shell program to rename files created by a GoPro into a single, sensible
// ordering of files so that the order is obvious for easy processing
// by other utulities such as RaceRender
//
// goPro naming conventions:
https://community.gopro.com/s/article/GoPro-Camera-File-Naming-Convention?language=en_USpackage main
import (
"fmt"
"
github.com/pfarrell51/gows/goprorename"
"os"
)
pfarrell@Alien15:~/whome/sandbox/gows/goprorename$ go build .
found packages goprorename (goprorename.go) and main (main.go) in /home/pfarrell/whome/sandbox/gows/goprorename
pfarrell@Alien15:~/whome/sandbox/gows/goprorename$ go build goprorename
package goprorename is not in GOROOT (/usr/local/go/src/goprorename)
pfarrell@Alien15:~/whome/sandbox/gows/goprorename$ go build main
package main is not in GOROOT (/usr/local/go/src/main)
pfarrell@Alien15:~/whome/sandbox/gows/goprorename$
pfarrell@Alien15:~/whome/sandbox/gows/goprorename$ go build main.go
main.go:11:2: found packages goprorename (goprorename.go) and main (main.go) in /home/pfarrell/whome/sandbox/gows/goprorename
// these two compile cleanly when explicitly built.
pfarrell@Alien15:~/whome/sandbox/gows/goprorename$ go build goprorename.go
pfarrell@Alien15:~/whome/sandbox/gows/goprorename$ go build goprorename_test.go