woodpecker/vendor/github.com/tdakkota/asciicheck
6543 56a854fe14
Update deps (#789)
* update github.com/docker/cli

* update github.com/docker/distribution

* update github.com/docker/docker

* update github.com/gin-gonic/gin

* update github.com/golang-jwt/jwt/v4

* update github.com/golangci/golangci-lint

* update github.com/gorilla/securecookie

* update github.com/mattn/go-sqlite3

* update github.com/moby/moby

* update github.com/prometheus/client_golang

* update github.com/xanzy/go-gitlab
2022-02-24 17:33:24 +01:00
..
.gitignore Update deps (#789) 2022-02-24 17:33:24 +01:00
ascii.go Update deps (#789) 2022-02-24 17:33:24 +01:00
asciicheck.go Add golangci-lint (#502) 2021-11-14 21:01:54 +01:00
go.mod Add golangci-lint (#502) 2021-11-14 21:01:54 +01:00
go.sum Update deps (#789) 2022-02-24 17:33:24 +01:00
LICENSE Add golangci-lint (#502) 2021-11-14 21:01:54 +01:00
README.md Add golangci-lint (#502) 2021-11-14 21:01:54 +01:00

asciicheck Go Report Card codecov Go

Simple linter to check that your code does not contain non-ASCII identifiers

Install

go get -u github.com/tdakkota/asciicheck/cmd/asciicheck

Reason to use

So, do you see this code? Looks correct, isn't it?

package main

import "fmt"

type TеstStruct struct{}

func main() {
	s := TestStruct{}
	fmt.Println(s)
}

But if you try to run it, you will get an error:

./prog.go:8:7: undefined: TestStruct

What? TestStruct is defined above, but compiler thinks diffrent. Why?

Answer: Because TestStruct is not TеstStruct.

type TеstStruct struct{}
      ^ this 'e' (U+0435) is not 'e' (U+0065)

Usage

asciicheck uses singlechecker package to run:

asciicheck: checks that all code identifiers does not have non-ASCII symbols in the name

Usage: asciicheck [-flag] [package]


Flags:
  -V	print version and exit
  -all
    	no effect (deprecated)
  -c int
    	display offending line with this many lines of context (default -1)
  -cpuprofile string
    	write CPU profile to this file
  -debug string
    	debug flags, any subset of "fpstv"
  -fix
    	apply all suggested fixes
  -flags
    	print analyzer flags in JSON
  -json
    	emit JSON output
  -memprofile string
    	write memory profile to this file
  -source
    	no effect (deprecated)
  -tags string
    	no effect (deprecated)
  -trace string
    	write trace log to this file
  -v	no effect (deprecated)