# Generated by go2rpm 1.15.0
%bcond check 1

# https://github.com/securego/gosec
%global goipath         github.com/securego/gosec/v2
Version:                2.21.4

%gometa -L -f

%global gomodulesmode GO111MODULE=on

%global common_description %{expand:
Go security checker.}

Name:           gosec
Release:        %autorelease
Summary:        Go security checker

# Generated by go-vendor-tools
License:        Apache-2.0 AND BSD-3-Clause AND ISC AND MIT AND MPL-2.0
URL:            %{gourl}
Source0:        %{gosource}
# Generated by go-vendor-tools
Source1:        %{archivename}-vendor.tar.bz2
Source2:        go-vendor-tools.toml

BuildRequires:  go-vendor-tools

%description %{common_description}

%prep
%goprep -A
%setup -q -T -D -a1 %{forgesetupargs}
%autopatch -p1

%generate_buildrequires
%go_vendor_license_buildrequires -c %{S:2}

%build
export LDFLAGS="-X main.Version=v%{version} \
                -X main.GitTag=v%{version} \
                -X main.BuildDate=$(date -d "@${SOURCE_DATE_EPOCH}" +%Y-%m-%d)"
                
%gobuild -o %{gobuilddir}/bin/gosec ./cmd/gosec

%install
%go_vendor_license_install -c %{S:2}
install -m 0755 -vd                     %{buildroot}%{_bindir}
install -m 0755 -vp %{gobuilddir}/bin/* %{buildroot}%{_bindir}/

%check
%go_vendor_license_check -c %{S:2}
%if %{with check}
# Some tests fail if go modules are not enabled
%gocheck -d autofix -d cmd/gosec -d rules
%endif

%files -f %{go_vendor_license_filelist}
%license vendor/modules.txt
%doc README.md USERS.md
%{_bindir}/gosec


%changelog
%autochangelog