mirror of
				https://github.com/go-gitea/gitea
				synced 2025-10-31 19:38:23 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			24 lines
		
	
	
		
			724 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			24 lines
		
	
	
		
			724 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
| #!/bin/bash
 | |
| set -uo pipefail
 | |
| 
 | |
| cd "$(dirname -- "${BASH_SOURCE[0]}")" && cd ..
 | |
| 
 | |
| IGNORE_PATTERNS=(
 | |
|   "is deprecated" # TODO: fix these
 | |
| )
 | |
| 
 | |
| # lint all go files with 'gopls check' and look for lines starting with the
 | |
| # current absolute path, indicating a error was found. This is necessary
 | |
| # because the tool does not set non-zero exit code when errors are found.
 | |
| # ref: https://github.com/golang/go/issues/67078
 | |
| ERROR_LINES=$("$GO" run "$GOPLS_PACKAGE" check "$@" 2>/dev/null | grep -E "^$PWD" | grep -vFf <(printf '%s\n' "${IGNORE_PATTERNS[@]}"));
 | |
| NUM_ERRORS=$(echo -n "$ERROR_LINES" | wc -l)
 | |
| 
 | |
| if [ "$NUM_ERRORS" -eq "0" ]; then
 | |
|   exit 0;
 | |
| else
 | |
|   echo "$ERROR_LINES"
 | |
|   echo "Found $NUM_ERRORS 'gopls check' errors"
 | |
|   exit 1;
 | |
| fi
 |