config

package
v0.0.0-...-ae1477a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 14, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package config contains the structure of the gotools config file, along with helpers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultVersion

func DefaultVersion(file string) (string, error)

Return the default go.mod version from a config.

Types

type Config

type Config struct {
	GoModVersion VersionConfig  `json:"go_mod_version"`
	TestFiles    TestFileConfig `json:"test_files"`
}

func Load

func Load(file string) (Config, error)

Load loads a configuration from a path to a JSON file.

type ExerciseVersion

type ExerciseVersion struct {
	Exercise string `json:"exercise"`
	Version  string `json:"version"`
}

ExerciseVersion represents the version one particular exercise should have in its go.mod file

type TestFileConfig

type TestFileConfig struct {
	Exclude map[string][]string `json:"exclude"`
}

type VersionConfig

type VersionConfig struct {
	// Default version for the go.mod files
	Default string `json:"default"`
	// List of exercises and their versions that must not have
	// the default version.
	Exceptions []ExerciseVersion `json:"exceptions"`
}

VersionConfig represents the version configuration

func (*VersionConfig) ExerciseExpectedVersion

func (vc *VersionConfig) ExerciseExpectedVersion(exercise string) string

ExerciseExpectedVersion gives the expected version the go.mod file for an exercise should be at. The argument should be the slug of an exercise.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL