1
0
mirror of https://github.com/taigrr/gopher-os synced 2025-01-18 04:43:13 -08:00

Merge pull request #11 from achilleasa/use-linter

Use linter and fix linter warnings
This commit is contained in:
Achilleas Anagnostopoulos 2017-05-15 06:59:01 +01:00 committed by GitHub
commit 1d8d81095c
7 changed files with 34 additions and 12 deletions

View File

@ -5,6 +5,7 @@ go:
before_install: before_install:
- go get -t -v ./... - go get -t -v ./...
script: script:
- make lint
- bash coverage.sh - bash coverage.sh
after_success: after_success:
- bash <(curl -s https://codecov.io/bash) - bash <(curl -s https://codecov.io/bash)

View File

@ -112,3 +112,29 @@ endif
clean: clean:
@test -d $(BUILD_DIR) && rm -rf $(BUILD_DIR) || true @test -d $(BUILD_DIR) && rm -rf $(BUILD_DIR) || true
lint: lint-check-deps
@echo "[gometalinter] linting sources"
@gometalinter.v1 \
--disable-all \
--enable=deadcode \
--enable=errcheck \
--enable=gosimple \
--enable=ineffassign \
--enable=misspell \
--enable=staticcheck \
--enable=vet \
--enable=vetshadow \
--enable=unconvert \
--enable=varcheck \
--enable=golint \
--deadline 300s \
--exclude 'return value not checked' \
--exclude 'possible misuse of unsafe.Pointer' \
./...
lint-check-deps:
@go get -u gopkg.in/alecthomas/gometalinter.v1
@gometalinter.v1 --install >/dev/null
test:

View File

@ -1,14 +1,10 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e set -e
go test -v -race ./...
echo "" > coverage.txt echo "" > coverage.txt
for d in $(go list ./... | grep -v vendor); do for d in $(go list ./... | grep -v vendor); do
# Running with -race and -covermode=atomic generates false positives so go test -race -coverprofile=profile.out -covermode=atomic $d
# we run the -race bit separately
go test -coverprofile=profile.out -covermode=atomic $d
if [ -f profile.out ]; then if [ -f profile.out ]; then
cat profile.out >> coverage.txt cat profile.out >> coverage.txt
rm profile.out rm profile.out

View File

@ -67,7 +67,7 @@ func (t *Vt) Write(data []byte) (int, error) {
return len(data), nil return len(data), nil
} }
// Write implements io.ByteWriter. // WriteByte implements io.ByteWriter.
func (t *Vt) WriteByte(b byte) error { func (t *Vt) WriteByte(b byte) error {
switch b { switch b {
case '\r': case '\r':

View File

@ -8,6 +8,8 @@ import (
var ( var (
egaConsole = &console.Ega{} egaConsole = &console.Ega{}
// ActiveTerminal points to the currently active terminal.
ActiveTerminal = &tty.Vt{} ActiveTerminal = &tty.Vt{}
) )

View File

@ -4,6 +4,7 @@ import "unsafe"
type tagType uint32 type tagType uint32
// nolint
const ( const (
tagMbSectionEnd tagType = iota tagMbSectionEnd tagType = iota
tagBootCmdLine tagBootCmdLine
@ -100,7 +101,7 @@ const (
memUnknown memUnknown
) )
/// MemoryMapEntry describes a memory region entry, namely its physical address, // MemoryMapEntry describes a memory region entry, namely its physical address,
// its length and its type. // its length and its type.
type MemoryMapEntry struct { type MemoryMapEntry struct {
// The physical address for this memory region. // The physical address for this memory region.

View File

@ -26,8 +26,4 @@ func Kmain(multibootInfoPtr uintptr) {
hal.InitTerminal() hal.InitTerminal()
hal.ActiveTerminal.Clear() hal.ActiveTerminal.Clear()
early.Printf("Starting gopher-os\n") early.Printf("Starting gopher-os\n")
// Prevent Kmain from returning
for {
}
} }