Browse Source

fix build break for plan9

tags/v1.4.2
David Bariod 6 months ago
parent
commit
744fc4caad

+ 1
- 0
go.sum View File

@@ -2,6 +2,7 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
2 2
 github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
3 3
 github.com/konsorten/go-windows-terminal-sequences v0.0.0-20180402223658-b729f2633dfe h1:CHRGQ8V7OlCYtwaKPJi3iA7J+YdNKdo8j7nG5IgDhjs=
4 4
 github.com/konsorten/go-windows-terminal-sequences v0.0.0-20180402223658-b729f2633dfe/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
5
+github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk=
5 6
 github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
6 7
 github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
7 8
 github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=

+ 0
- 11
terminal_check_nacl.go View File

@@ -1,11 +0,0 @@
1
-// +build nacl
2
-
3
-package logrus
4
-
5
-import (
6
-	"io"
7
-)
8
-
9
-func checkIfTerminal(w io.Writer) bool {
10
-	return false
11
-}

terminal_check_js.go → terminal_check_no_terminal.go View File

@@ -1,4 +1,4 @@
1
-// +build js
1
+// +build js nacl plan9
2 2
 
3 3
 package logrus
4 4
 

+ 1
- 1
terminal_check_notappengine.go View File

@@ -1,4 +1,4 @@
1
-// +build !appengine,!js,!windows,!nacl
1
+// +build !appengine,!js,!windows,!nacl,!plan9
2 2
 
3 3
 package logrus
4 4
 

+ 16
- 2
terminal_check_windows.go View File

@@ -6,15 +6,29 @@ import (
6 6
 	"io"
7 7
 	"os"
8 8
 	"syscall"
9
+
10
+	sequences "github.com/konsorten/go-windows-terminal-sequences"
9 11
 )
10 12
 
13
+func initTerminal(w io.Writer) {
14
+	switch v := w.(type) {
15
+	case *os.File:
16
+		sequences.EnableVirtualTerminalProcessing(syscall.Handle(v.Fd()), true)
17
+	}
18
+}
19
+
11 20
 func checkIfTerminal(w io.Writer) bool {
21
+	var ret bool
12 22
 	switch v := w.(type) {
13 23
 	case *os.File:
14 24
 		var mode uint32
15 25
 		err := syscall.GetConsoleMode(syscall.Handle(v.Fd()), &mode)
16
-		return err == nil
26
+		ret = (err == nil)
17 27
 	default:
18
-		return false
28
+		ret = false
29
+	}
30
+	if ret {
31
+		initTerminal(w)
19 32
 	}
33
+	return ret
20 34
 }

+ 0
- 8
terminal_notwindows.go View File

@@ -1,8 +0,0 @@
1
-// +build !windows
2
-
3
-package logrus
4
-
5
-import "io"
6
-
7
-func initTerminal(w io.Writer) {
8
-}

+ 0
- 18
terminal_windows.go View File

@@ -1,18 +0,0 @@
1
-// +build !appengine,!js,windows
2
-
3
-package logrus
4
-
5
-import (
6
-	"io"
7
-	"os"
8
-	"syscall"
9
-
10
-	sequences "github.com/konsorten/go-windows-terminal-sequences"
11
-)
12
-
13
-func initTerminal(w io.Writer) {
14
-	switch v := w.(type) {
15
-	case *os.File:
16
-		sequences.EnableVirtualTerminalProcessing(syscall.Handle(v.Fd()), true)
17
-	}
18
-}

+ 0
- 4
text_formatter.go View File

@@ -84,10 +84,6 @@ type TextFormatter struct {
84 84
 func (f *TextFormatter) init(entry *Entry) {
85 85
 	if entry.Logger != nil {
86 86
 		f.isTerminal = checkIfTerminal(entry.Logger.Out)
87
-
88
-		if f.isTerminal {
89
-			initTerminal(entry.Logger.Out)
90
-		}
91 87
 	}
92 88
 }
93 89
 

+ 1
- 1
travis/cross_build.sh View File

@@ -1,5 +1,5 @@
1 1
 #!/bin/bash
2 2
 
3 3
 if [[ "$TRAVIS_GO_VERSION" =~ ^1.\12\. ]] && [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
4
-    /tmp/gox/gox -build-lib -all -os '!plan9 !nacl'
4
+    /tmp/gox/gox -build-lib -all
5 5
 fi

Loading…
Cancel
Save