* Added Make targets for gofmt

- `make check-gofmt` will check for files that aren't gofmt compliant
- `make gofmt` will fix any gofmt error's in Aminal's source

Vendored files are ignored.

* Add gofmt check to TravisCI checks

* Fix gofmt errors
This commit is contained in:
Menno Finlay-Smits 2019-02-15 05:45:53 +13:00 committed by Liam Galvin
parent 6ded551de9
commit 35193b7981
13 changed files with 38 additions and 26 deletions

View File

@ -29,6 +29,7 @@ script:
- if [[ $TRAVIS_OS_NAME == 'osx' ]]; then make build-darwin-native-travis; fi
- if [[ $TRAVIS_OS_NAME == 'linux' ]]; then make build-linux-travis; fi
- if [[ $TRAVIS_OS_NAME == 'linux' ]]; then make windows-cross-compile-travis; fi
- if [[ $TRAVIS_OS_NAME == 'linux' ]]; then make check-gofmt; fi
env:
global:
- secure: "pdRpTOGQSUgbC9tK37voxUYJHMWDPJEmdMhNBsljpP9VnxxbR6JEFwvOQEmUHGlsYv8jma6a17jE60ngVQk8QP12cPh48i2bdbVgym/zTUOKFawCtPAzs8i7evh0di5eZ3uoyc42kG4skc+ePuVHbXC8jDxwaPpMqSHD7QyQc1/6ckI9LLkyWUqhnJJXkVwhmI74Aa1Im6QhywAWFMeTBRRL02cwr6k7VKSYOn6yrtzJRCALFGpZ/n58lPrpDxN7W8o+HRQP89wIDy8FyNeEPdmqGFNfMHDvI3oJRN4dGC4H9EkKf/iGuNJia1Bs+MgaG9kKlMHsI6Fkh5uw9KNTvC1llx43VRQJzm26cn1CpRxxRtF4F8lqkpY4tHjxxCitV+98ddW8jdmQYyx+LeueC5wqlO9g2M5L3oXsGMqZ++mDRDa8oQoQAVUSVtimeO8ODXFuVNR8TlupP0Cthgucil63VUZfAD8EHc2zpRSFxfYByDH53uMEinn20uovL6W42fqgboC43HOnR6aVfSANPsBFDlcpZFa2BY5RkcKyYdaLkucy0DKJ946UDfhOu6FNm0GPHq5HcgWkLojNF0dEFgG6J+SGQGiPjxTlHP/zoe61qMlWu+fYRXQnKWZN5Kk0T1TbAk6pKSE6wRLG8ddxvMg+eVpGLT+gAvQdrrkMFvs="

View File

@ -11,6 +11,15 @@ test:
go test -v ./...
go vet -v
.PHONY: check-gofmt
check-gofmt:
$(eval files := $(shell gofmt -l `find -name '*.go' | grep -v vendor`))
$(if $(files),@echo "Some files not gofmt compliant: $(files)"; exit 1, @exit 0)
.PHONY: gofmt
gofmt:
gofmt -w -l `find -name '*.go' | grep -v vendor`
.PHONY: install
install: build
go install -ldflags "-X github.com/liamg/aminal/version.Version=`git describe --tags`"

View File

@ -7,6 +7,7 @@ import (
"os"
"os/user"
"path/filepath"
"github.com/liamg/aminal/config"
"github.com/liamg/aminal/version"
)

View File

@ -745,4 +745,3 @@ func (gui *GUI) windowPosChangeCallback(w *glfw.Window, xpos int, ypos int) {
func (gui *GUI) monitorChangeCallback(monitor *glfw.Monitor, event glfw.MonitorEvent) {
gui.SetDPIScale()
}

View File

@ -5,9 +5,9 @@ import (
"math"
"github.com/go-gl/glfw/v3.2/glfw"
"github.com/liamg/aminal/buffer"
"github.com/liamg/aminal/terminal"
"time"
"github.com/liamg/aminal/buffer"
)
func (gui *GUI) glfwScrollCallback(w *glfw.Window, xoff float64, yoff float64) {

View File

@ -92,7 +92,8 @@ func TestCursorMovement(t *testing.T) {
runMain(func() {
testFunc := func(term *terminal.Terminal, g *gui.GUI) {
termRef = term; guiRef = g
termRef = term
guiRef = g
sleep()
send(term, "vttest\n")
@ -122,7 +123,8 @@ func TestScreenFeatures(t *testing.T) {
runMain(func() {
testFunc := func(term *terminal.Terminal, g *gui.GUI) {
termRef = term; guiRef = g
termRef = term
guiRef = g
sleep()
send(term, "vttest\n")

View File

@ -165,9 +165,9 @@ package platform
import "C"
import (
"errors"
"os"
"syscall"
"unicode/utf16"
"os"
)
var procsInitSucceeded = false