Skip to content

Commit

Permalink
go: lints & cleanup
Browse files Browse the repository at this point in the history
Remove dead code, make 'go list' happy.
  • Loading branch information
rmg committed Jun 29, 2023
1 parent 8b9647f commit 54fabb2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 31 deletions.
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module main

go 1.20
1 change: 1 addition & 0 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

//go:build ignore
#include <sys/types.h>
#include <stdio.h>
#include <string.h>
Expand Down
31 changes: 0 additions & 31 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,8 @@ limitations under the License.
package main

import (
"fmt"
"io"
"log"
"os"
"runtime"
"runtime/pprof"
)

const BUF = 64 * 4096
Expand Down Expand Up @@ -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)
}
}
}

0 comments on commit 54fabb2

Please sign in to comment.