Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name: Build Docker Image

# Defines environmental variables
env:
GO_VERSION: '1.24.3'
GO_LINTER_VERSION: 'v1.64.6'
GO_VERSION: '1.25.3'
GO_LINTER_VERSION: 'v2.5.0'

# Controls when the action will run
on:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Build and Publish Snapshot

env:
GO_VERSION: '1.24.3'
GO_LINTER_VERSION: 'v1.64.6'
GO_VERSION: '1.25.3'
GO_LINTER_VERSION: 'v2.5.0'
DOCKER_REGISTRY_ACCOUNT: ${{ vars.DOCKER_REGISTRY_ACCOUNT }}

on:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
name: Build and Publish Release

env:
GO_VERSION: '1.24.1'
GO_LINTER_VERSION: 'v1.64.6'
GO_VERSION: '1.25.3'
GO_LINTER_VERSION: 'v2.5.0'
DOCKER_REGISTRY_ACCOUNT: ${{ vars.DOCKER_REGISTRY_ACCOUNT }}

on:
release:
types: [ published, released ]
workflow_dispatch:

jobs:
release:
runs-on: ubuntu-latest
Expand Down
17 changes: 14 additions & 3 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@

version: "2"

linters:
enable:
- revive
- gofmt
- goimports
- typecheck
- errcheck
- unparam
- ineffassign

linters-settings:
revive:
config: .revive.toml

formatters:
enable:
- gofmt
- goimports
settings:
gofmt:
simplify: true
goimports:
local-prefixes:
- github.com/UCLALibrary/validation-service
6 changes: 3 additions & 3 deletions .revive.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

ignoreGeneratedHeader = false
severity = "warning"

[[rule]]
name = "comment-format"
arguments = ["error"]
[rule."var-naming"]
arguments = [[], [], [{ skipPackageNameChecks = true }]]
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ FORCE:
all: config api lint build test docker-test # Does a full build of the project

lint: # Checks the code for correctness / coding standards
golangci-lint run --out-format=colored-line-number --fix
golangci-lint run --output.text.path=stdout --output.text.colors=true --fix

# We generate Go API code from the OpenAPI specification only when it has changed
# We assume Windows developers are using WSL, so we don't define $(CP) for this
Expand Down
2 changes: 1 addition & 1 deletion api/api.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/UCLALibrary/validation-service

go 1.24.3
go 1.25.3

require (
github.com/docker/docker v28.5.1+incompatible
Expand Down
9 changes: 5 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,15 @@ import (

"github.com/UCLALibrary/validation-service/validation"

"github.com/UCLALibrary/validation-service/api"
"github.com/UCLALibrary/validation-service/validation/config"
"github.com/UCLALibrary/validation-service/validation/csv"
"github.com/UCLALibrary/validation-service/validation/util"
"github.com/labstack/echo/v4"
accept "github.com/labstack/echo/v4/middleware"
middleware "github.com/oapi-codegen/echo-middleware"
"go.uber.org/zap"

"github.com/UCLALibrary/validation-service/api"
"github.com/UCLALibrary/validation-service/validation/config"
"github.com/UCLALibrary/validation-service/validation/csv"
"github.com/UCLALibrary/validation-service/validation/util"
)

// Port is the default port for our server
Expand Down
3 changes: 2 additions & 1 deletion validation/checks/ark_check.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ import (

"github.com/UCLALibrary/validation-service/validation/config"

"go.uber.org/multierr"

"github.com/UCLALibrary/validation-service/errors"
"github.com/UCLALibrary/validation-service/validation/csv"
"go.uber.org/multierr"
)

// ItemARK is the ARK of the current item.
Expand Down
5 changes: 3 additions & 2 deletions validation/checks/fields_check.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ import (

"github.com/UCLALibrary/validation-service/validation/util"

"github.com/UCLALibrary/validation-service/errors"
"github.com/UCLALibrary/validation-service/validation/csv"
"go.uber.org/multierr"
"go.uber.org/zap"

"github.com/UCLALibrary/validation-service/errors"
"github.com/UCLALibrary/validation-service/validation/csv"
)

var profileFields = map[string]map[string]struct {
Expand Down
6 changes: 4 additions & 2 deletions validation/checks/license_check.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,10 @@ func (check *LicenseCheck) verifyLicense(license string, profile string, locatio
if err != nil {
return csv.NewError(errors.URLConnectErr, location, profile)
}
//noinspection GoUnhandledErrorResult
defer resp.Body.Close()
defer func() {
_ = resp.Body.Close()
}()

_, err = io.ReadAll(resp.Body)
if err != nil {
return csv.NewError(errors.URLReadErr, location, profile)
Expand Down
3 changes: 2 additions & 1 deletion validation/checks/mediaMeta_check.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import (

"github.com/UCLALibrary/validation-service/validation/config"

"go.uber.org/multierr"

"github.com/UCLALibrary/validation-service/errors"
"github.com/UCLALibrary/validation-service/validation/csv"
"go.uber.org/multierr"
)

// MediaMetaCheck validates the media.* fields for the Fester profile.
Expand Down
2 changes: 1 addition & 1 deletion validation/checks/unicode_check.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file checks if the provided License is correct.
// Package checks if the provided License is correct.
package checks

import (
Expand Down
1 change: 1 addition & 0 deletions validation/config/profile_doc_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package config contains tests for validation configuration.
package config

import (
Expand Down
5 changes: 3 additions & 2 deletions validation/config/profiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,9 @@ func (profiles *Profiles) Refresh() error {
if err != nil {
return fmt.Errorf("failed to open '%s' file: %w", filePath, err)
}
//noinspection GoUnhandledErrorResult
defer file.Close()
defer func() {
_ = file.Close()
}()

// Decode the persisted JSON file into a profilesSnapshot
decoder := json.NewDecoder(file)
Expand Down
3 changes: 2 additions & 1 deletion validation/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ import (

"github.com/UCLALibrary/validation-service/validation/config"

"github.com/UCLALibrary/validation-service/validation/csv"
"go.uber.org/multierr"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"

"github.com/UCLALibrary/validation-service/validation/csv"
)

// Engine performs the CSV file validations.
Expand Down
3 changes: 2 additions & 1 deletion validation/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package validation
import (
"fmt"

"go.uber.org/zap"

"github.com/UCLALibrary/validation-service/validation/checks"
"github.com/UCLALibrary/validation-service/validation/config"
"go.uber.org/zap"
)

// Registry keeps a collection of registered validators.
Expand Down
2 changes: 1 addition & 1 deletion validation/util/context.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Package util provides useful resources and utilities.
package util
package util //nolint:revive

import "github.com/UCLALibrary/validation-service/validation/csv"

Expand Down
2 changes: 1 addition & 1 deletion validation/util/logger.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package util
package util //nolint:revive

import (
"github.com/labstack/echo/v4"
Expand Down