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:
- go get -t -v ./...
script:
- make lint
- bash coverage.sh
after_success:
- bash <(curl -s https://codecov.io/bash)

View File

@ -112,3 +112,29 @@ endif
clean:
@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
set -e
go test -v -race ./...
echo "" > coverage.txt
for d in $(go list ./... | grep -v vendor); do
# Running with -race and -covermode=atomic generates false positives so
# we run the -race bit separately
go test -coverprofile=profile.out -covermode=atomic $d
go test -race -coverprofile=profile.out -covermode=atomic $d
if [ -f profile.out ]; then
cat profile.out >> coverage.txt
rm profile.out

View File

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

View File

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

View File

@ -4,6 +4,7 @@ import "unsafe"
type tagType uint32
// nolint
const (
tagMbSectionEnd tagType = iota
tagBootCmdLine
@ -100,7 +101,7 @@ const (
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.
type MemoryMapEntry struct {
// The physical address for this memory region.

View File

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