Skip to content

Commit 8135be4

Browse files
GNUmakefile: add spellfix target, use it. (#4387)
TODO: Remove the go.mod/go.sum in internal/tools once doing so doesn't break CI (e.g. once we drop support for go 1.19) * builder/cc1as.h: fix typo found by 'make spell' * GNUmakefile: remove exception for inbetween, fix instance now found by 'make spell' * GNUmakefile: remove exception for programmmer, fix instance now found by 'make spell' * go.mod: use updated misspell. GNUmakefile: add spellfix target, use it. * ignore directories properly when invoking spellchecker. * make spell: give internal/tools its own go.mod, as misspell requires newer go * make lint: depend on tools and run the installed revive (which was perhaps implied by the change that added revive to internal/tools, but not required in GNUmakefile until we gave internal/tools its own temporary go.mod) * .github: now that 'make spell' works well, run it from CI * GNUmakefile: make spell now aborts if it finds misspelt words, so what it finds doesn't get lost in CI logs * GNUmakefile: tools: avoid -C option on go generate to make test-llvm15-go119 circleci job happy, see https://cs.opensource.google/go/go/+/2af48cbb7d85e5fdc635e75b99f949010c607786 * internal/tools/go.mod: fix format of go version to leave out patchlevel, else go complains.
1 parent 835e732 commit 8135be4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+169
-93
lines changed

.github/workflows/linux.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ jobs:
115115
gem install --no-document fpm
116116
- name: Run linter
117117
run: make lint
118+
- name: Run spellcheck
119+
run: make spell
118120
- name: Build TinyGo release
119121
run: |
120122
make release deb -j3 STATIC=1

GNUmakefile

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -949,20 +949,25 @@ endif
949949

950950
.PHONY: tools
951951
tools:
952-
go generate -C ./internal/tools -tags tools ./
952+
cd internal/tools && go generate -tags tools ./
953953

954954
.PHONY: lint
955-
lint: ## Lint source tree
956-
go run github.com/mgechev/revive -version
955+
lint: tools ## Lint source tree
956+
revive -version
957957
# TODO: lint more directories!
958958
# revive.toml isn't flexible enough to filter out just one kind of error from a checker, so do it with grep here.
959959
# Can't use grep with friendly formatter. Plain output isn't too bad, though.
960960
# Use 'grep .' to get rid of stray blank line
961-
go run github.com/mgechev/revive -config revive.toml compiler/... src/{os,reflect}/*.go | grep -v "should have comment or be unexported" | grep '.' | awk '{print}; END {exit NR>0}'
961+
revive -config revive.toml compiler/... src/{os,reflect}/*.go | grep -v "should have comment or be unexported" | grep '.' | awk '{print}; END {exit NR>0}'
962962

963+
SPELLDIRSCMD=find . -depth 1 -type d | egrep -wv '.git|lib|llvm|src'; find src -depth 1 | egrep -wv 'device|internal|net|vendor'; find src/internal -depth 1 -type d | egrep -wv src/internal/wasi
963964
.PHONY: spell
964-
spell: ## Spellcheck source tree
965-
go run github.com/client9/misspell/cmd/misspell -i 'ackward,devided,extint,inbetween,programmmer,rela' $$( find . -depth 1 -type d | egrep -w -v 'lib|llvm|src/net' )
965+
spell: tools ## Spellcheck source tree
966+
misspell -error --dict misspell.csv -i 'ackward,devided,extint,rela' $$( $(SPELLDIRSCMD) )
967+
968+
.PHONY: spellfix
969+
spellfix: tools ## Same as spell, but fixes what it finds
970+
misspell -w --dict misspell.csv -i 'ackward,devided,extint,rela' $$( $(SPELLDIRSCMD) )
966971

967972
# https://www.client9.com/self-documenting-makefiles/
968973
.PHONY: help

builder/ar.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
"github.com/blakesmith/ar"
1717
)
1818

19-
// makeArchive creates an arcive for static linking from a list of object files
19+
// makeArchive creates an archive for static linking from a list of object files
2020
// given as a parameter. It is equivalent to the following command:
2121
//
2222
// ar -rcs <archivePath> <objs...>

builder/cc1as.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ struct AssemblerInvocation {
9393
EmitDwarfUnwindType EmitDwarfUnwind;
9494

9595
// Whether to emit compact-unwind for non-canonical entries.
96-
// Note: maybe overriden by other constraints.
96+
// Note: maybe overridden by other constraints.
9797
unsigned EmitCompactUnwindNonCanonical : 1;
9898

9999
/// The name of the relocation model to use.

builder/tools.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func link(linker string, flags ...string) error {
4949
err := cmd.Run()
5050
if err != nil {
5151
if buf.Len() == 0 {
52-
// The linker failed but ther was no output.
52+
// The linker failed but there was no output.
5353
// Therefore, show some output anyway.
5454
return fmt.Errorf("failed to run linker: %w", err)
5555
}

compileopts/config.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func (c *Config) GOOS() string {
6060
}
6161

6262
// GOARCH returns the GOARCH of the target. This might not always be the actual
63-
// archtecture: for example, the AVR target is not supported by the Go standard
63+
// architecture: for example, the AVR target is not supported by the Go standard
6464
// library so such targets will usually pretend to be linux/arm.
6565
func (c *Config) GOARCH() string {
6666
return c.Target.GOARCH
@@ -461,7 +461,7 @@ func (c *Config) BinaryFormat(ext string) string {
461461

462462
// Programmer returns the flash method and OpenOCD interface name given a
463463
// particular configuration. It may either be all configured in the target JSON
464-
// file or be modified using the -programmmer command-line option.
464+
// file or be modified using the -programmer command-line option.
465465
func (c *Config) Programmer() (method, openocdInterface string) {
466466
switch c.Options.Programmer {
467467
case "":

compiler/asserts.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ func (b *builder) createUnsafeSliceStringCheck(name string, ptr, len llvm.Value,
9999
// However, in practice, it is also necessary to check that the length is
100100
// not too big that a GEP wouldn't be possible without wrapping the pointer.
101101
// These two checks (non-negative and not too big) can be merged into one
102-
// using an unsiged greater than.
102+
// using an unsigned greater than.
103103

104104
// Make sure the len value is at least as big as a uintptr.
105105
len = b.extendInteger(len, lenType, b.uintptrType)

compiler/compiler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ func NewTargetMachine(config *Config) (llvm.TargetMachine, error) {
242242
}
243243

244244
// Sizes returns a types.Sizes appropriate for the given target machine. It
245-
// includes the correct int size and aligment as is necessary for the Go
245+
// includes the correct int size and alignment as is necessary for the Go
246246
// typechecker.
247247
func Sizes(machine llvm.TargetMachine) types.Sizes {
248248
targetData := machine.CreateTargetData()

compiler/gc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func (b *builder) trackValue(value llvm.Value) {
7878
}
7979
}
8080

81-
// trackPointer creates a call to runtime.trackPointer, bitcasting the poitner
81+
// trackPointer creates a call to runtime.trackPointer, bitcasting the pointer
8282
// first if needed. The input value must be of LLVM pointer type.
8383
func (b *builder) trackPointer(value llvm.Value) {
8484
b.createRuntimeCall("trackPointer", []llvm.Value{value, b.stackChainAlloca}, "")

compiler/interface.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ func (b *builder) createMakeInterface(val llvm.Value, typ types.Type, pos token.
8686

8787
// extractValueFromInterface extract the value from an interface value
8888
// (runtime._interface) under the assumption that it is of the type given in
89-
// llvmType. The behavior is undefied if the interface is nil or llvmType
89+
// llvmType. The behavior is undefined if the interface is nil or llvmType
9090
// doesn't match the underlying type of the interface.
9191
func (b *builder) extractValueFromInterface(itf llvm.Value, llvmType llvm.Type) llvm.Value {
9292
valuePtr := b.CreateExtractValue(itf, 1, "typeassert.value.ptr")

0 commit comments

Comments
 (0)