Skip to content

Commit

Permalink
Merge pull request #12 from ttd2089/fix/avoid-init-order
Browse files Browse the repository at this point in the history
fix: remove init functions to avoid order problems
  • Loading branch information
tshowers-bt authored Jun 30, 2022
2 parents 0a07e7a + c39343c commit 7dd27a9
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 22 deletions.
2 changes: 1 addition & 1 deletion gitignore.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
// GitIgnoreSupported indicates whether the GitIgnored function is available.
var GitIgnoreSupported = false

func init() {
func initGitignore() {
if _, err := exec.LookPath("git"); err != nil {
logger.Printf("gitignore not supported: %v", err)
} else {
Expand Down
20 changes: 11 additions & 9 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
module github.com/ttd2089/pocket

go 1.14

require (
github.com/fsnotify/fsnotify v1.4.9
github.com/go-test/deep v1.0.6
github.com/pborman/getopt v0.0.0-20190409184431-ee0cd42419d3
)
module github.com/ttd2089/pocket

go 1.18

require (
github.com/fsnotify/fsnotify v1.4.9
github.com/go-test/deep v1.0.6
github.com/pborman/getopt v0.0.0-20190409184431-ee0cd42419d3
)

require golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9 // indirect
12 changes: 0 additions & 12 deletions logger.go

This file was deleted.

10 changes: 10 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"fmt"
"io"
"io/ioutil"
"log"
"os"
"os/exec"
Expand All @@ -13,6 +14,15 @@ import (

var productVersion = "0.0.0"

var logger *log.Logger

func init() {

logger = log.New(ioutil.Discard, "", log.LstdFlags)

initGitignore()
}

func main() {

cli := getopt.New()
Expand Down
1 change: 1 addition & 0 deletions main_nonwindows.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !windows
// +build !windows

package main
Expand Down

0 comments on commit 7dd27a9

Please sign in to comment.