Merge pull request #932 from tandr/drop-crypto-2

Drop x/crypto package dependency
This commit is contained in:
David Bariod 2019-03-28 09:41:56 +01:00 committed by GitHub
commit 787e519fa8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 28 additions and 20 deletions

View File

@ -7,7 +7,6 @@ matrix:
- go: 1.10.x - go: 1.10.x
install: install:
- go get github.com/stretchr/testify/assert - go get github.com/stretchr/testify/assert
- go get golang.org/x/crypto/ssh/terminal
- go get golang.org/x/sys/unix - go get golang.org/x/sys/unix
- go get golang.org/x/sys/windows - go get golang.org/x/sys/windows
script: script:
@ -22,7 +21,6 @@ matrix:
env: GO111MODULE=off env: GO111MODULE=off
install: install:
- go get github.com/stretchr/testify/assert - go get github.com/stretchr/testify/assert
- go get golang.org/x/crypto/ssh/terminal
- go get golang.org/x/sys/unix - go get golang.org/x/sys/unix
- go get golang.org/x/sys/windows - go get golang.org/x/sys/windows
script: script:
@ -37,7 +35,6 @@ matrix:
env: GO111MODULE=off env: GO111MODULE=off
install: install:
- go get github.com/stretchr/testify/assert - go get github.com/stretchr/testify/assert
- go get golang.org/x/crypto/ssh/terminal
- go get golang.org/x/sys/unix - go get golang.org/x/sys/unix
- go get golang.org/x/sys/windows - go get golang.org/x/sys/windows
script: script:
@ -45,7 +42,6 @@ matrix:
- go: 1.10.x - go: 1.10.x
install: install:
- go get github.com/stretchr/testify/assert - go get github.com/stretchr/testify/assert
- go get golang.org/x/crypto/ssh/terminal
- go get golang.org/x/sys/unix - go get golang.org/x/sys/unix
- go get golang.org/x/sys/windows - go get golang.org/x/sys/windows
script: script:
@ -60,7 +56,6 @@ matrix:
env: GO111MODULE=off env: GO111MODULE=off
install: install:
- go get github.com/stretchr/testify/assert - go get github.com/stretchr/testify/assert
- go get golang.org/x/crypto/ssh/terminal
- go get golang.org/x/sys/unix - go get golang.org/x/sys/unix
- go get golang.org/x/sys/windows - go get golang.org/x/sys/windows
script: script:
@ -75,7 +70,6 @@ matrix:
env: GO111MODULE=off env: GO111MODULE=off
install: install:
- go get github.com/stretchr/testify/assert - go get github.com/stretchr/testify/assert
- go get golang.org/x/crypto/ssh/terminal
- go get golang.org/x/sys/unix - go get golang.org/x/sys/unix
- go get golang.org/x/sys/windows - go get golang.org/x/sys/windows
script: script:

1
go.mod
View File

@ -6,6 +6,5 @@ require (
github.com/pmezard/go-difflib v1.0.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/stretchr/objx v0.1.1 // indirect github.com/stretchr/objx v0.1.1 // indirect
github.com/stretchr/testify v1.2.2 github.com/stretchr/testify v1.2.2
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33 golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33
) )

2
go.sum
View File

@ -9,7 +9,5 @@ github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793 h1:u+LnwYTOOW7Ukr/fppxEb1Nwz0AtPflrblfvUudpo+I=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33 h1:I6FyU15t786LL7oL/hn43zqTuEGr4PN7F4XJ1p4E3Y8= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33 h1:I6FyU15t786LL7oL/hn43zqTuEGr4PN7F4XJ1p4E3Y8=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=

View File

@ -0,0 +1,13 @@
// +build darwin dragonfly freebsd netbsd openbsd
package terminal
import "golang.org/x/sys/unix"
const ioctlReadTermios = unix.TIOCGETA
func IsTerminal(fd int) bool {
_, err := unix.IoctlGetTermios(fd, ioctlReadTermios)
return err == nil
}

View File

@ -0,0 +1,13 @@
// +build linux aix
package terminal
import "golang.org/x/sys/unix"
const ioctlReadTermios = unix.TCGETS
func IsTerminal(fd int) bool {
_, err := unix.IoctlGetTermios(fd, ioctlReadTermios)
return err == nil
}

View File

@ -1,9 +0,0 @@
// +build !appengine,!js,!windows,aix
package logrus
import "io"
func checkIfTerminal(w io.Writer) bool {
return false
}

View File

@ -1,4 +1,4 @@
// +build !appengine,!js,!windows,!aix // +build !appengine,!js,!windows
package logrus package logrus
@ -6,7 +6,7 @@ import (
"io" "io"
"os" "os"
"golang.org/x/crypto/ssh/terminal" "github.com/sirupsen/logrus/internal/terminal"
) )
func checkIfTerminal(w io.Writer) bool { func checkIfTerminal(w io.Writer) bool {