Skip to content

Commit

Permalink
development/golangci-lint: Added (Fast linters runner for Go).
Browse files Browse the repository at this point in the history
  • Loading branch information
aclemons authored and sbo-bot[bot] committed Dec 14, 2024
1 parent dfb4fb4 commit baf531f
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 0 deletions.
5 changes: 5 additions & 0 deletions development/golangci-lint/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
golangci-lint - Fast linters runner for Go

Warning: This SlackBuild requires network access when it runs, meaning
it downloads files from the Internet with root access. You should
decide for yourself whether or not you think this is a good idea.
88 changes: 88 additions & 0 deletions development/golangci-lint/golangci-lint.SlackBuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
#!/bin/bash

# Slackware build script for golangci-lint

# Copyright 2024 Andrew Clemons, Tokyo Japan
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

cd $(dirname $0) ; CWD=$(pwd)

PRGNAM=golangci-lint
VERSION=${VERSION:-1.62.2}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}

if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i586 ;;
arm*) ARCH=arm ;;
*) ARCH=$( uname -m ) ;;
esac
fi

if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
exit 0
fi

TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}

set -e

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
cd $PRGNAM-$VERSION
chown -R root:root .
rm -rf test
find -L . \
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
-o -perm 511 \) -exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;

go build -v -ldflags "-X main.version=$VERSION -X main.commit=$(bsdcat $CWD/$PRGNAM-$VERSION.tar.gz | git get-tar-commit-id | cut -c 1-7) -X main.date=$(date -u "+%Y-%m-%dT%TZ")" ./cmd/golangci-lint

./golangci-lint completion bash > $PRGNAM.bash
./golangci-lint completion zsh > $PRGNAM.zsh

install -Dm755 $PRGNAM -t $PKG/usr/bin
install -Dm644 $PRGNAM.bash $PKG/usr/share/bash-completion/completions/$PRGNAM
install -Dm644 $PRGNAM.zsh $PKG/usr/share/zsh/site-functions/_$PRGNAM

find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true

mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a \
CHANGELOG.md LICENSE README.md \
$PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild

mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc

cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE
10 changes: 10 additions & 0 deletions development/golangci-lint/golangci-lint.info
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
PRGNAM="golangci-lint"
VERSION="1.62.2"
HOMEPAGE="https://github.com/golangci/golangci-lint"
DOWNLOAD="https://github.com/golangci/golangci-lint/archive/v1.62.2/golangci-lint-1.62.2.tar.gz"
MD5SUM="4c130e3bd2a0832e0f1b5b3aa247de9e"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES="google-go-lang"
MAINTAINER="Andrew Clemons"
EMAIL="[email protected]"
19 changes: 19 additions & 0 deletions development/golangci-lint/slack-desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description.
# Line up the first '|' above the ':' following the base package name, and
# the '|' on the right side marks the last column you can put a character in.
# You must make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':' except on otherwise blank lines.

|-----handy-ruler------------------------------------------------------|
golangci-lint: golangci-lint (golangci-lint)
golangci-lint:
golangci-lint: golangci-lint is a fast Go linters runner.
golangci-lint:
golangci-lint: It runs linters in parallel, uses caching, supports YAML
golangci-lint: configuration, integrates with all major IDEs, and includes over a
golangci-lint: hundred linters.
golangci-lint:
golangci-lint: https://github.com/golangci/golangci-lint
golangci-lint:
golangci-lint:

0 comments on commit baf531f

Please sign in to comment.