From 54fabb2d1f6d65473a5427528669400931a8b0f5 Mon Sep 17 00:00:00 2001 From: Ryann Graham Date: Thu, 29 Jun 2023 13:38:43 -0700 Subject: [PATCH] go: lints & cleanup Remove dead code, make 'go list' happy. --- go.mod | 3 +++ main.c | 1 + main.go | 31 ------------------------------- 3 files changed, 4 insertions(+), 31 deletions(-) create mode 100644 go.mod diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..1e03b32 --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module main + +go 1.20 diff --git a/main.c b/main.c index baa67b9..85d90e4 100644 --- a/main.c +++ b/main.c @@ -14,6 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ +//go:build ignore #include #include #include diff --git a/main.go b/main.go index 873e380..4d5a232 100644 --- a/main.go +++ b/main.go @@ -16,12 +16,8 @@ limitations under the License. package main import ( - "fmt" "io" - "log" "os" - "runtime" - "runtime/pprof" ) const BUF = 64 * 4096 @@ -86,30 +82,3 @@ func scan(input io.Reader) { func main() { scan(os.Stdin) } - -func pmain() { - c, err := os.Create("sha1scan.cpu.prof") - if err != nil { - log.Fatal("could not create CPU profile: ", err) - } - defer c.Close() - if err := pprof.StartCPUProfile(c); err != nil { - log.Fatal("could not start CPU profile: ", err) - } - - scan(os.Stdin) - - pprof.StopCPUProfile() - runtime.GC() // get up-to-date statistics - - for _, p := range pprof.Profiles() { - m, err := os.Create(fmt.Sprintf("sha1scan.%s.prof", p.Name())) - if err != nil { - log.Fatalf("could not create %s profile: ", p.Name(), err) - } - defer m.Close() - if err := p.WriteTo(m, 1); err != nil { - log.Fatal("could not write %s profile: ", p.Name(), err) - } - } -}