config

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2020 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Overview

Package config implements a parse of init.vim configs and user environment variables.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ChannelID remote plugins channel id.
	ChannelID int
	// ServerName Neovim socket listen location.
	ServerName string
	// ErrorListType type of error list window.
	ErrorListType string

	// BuildAppengine enable appengine bulid.
	BuildAppengine bool
	// BuildAutosave call the GoBuild command automatically at during the BufWritePost.
	BuildAutosave bool
	// BuildForce builds the binary instead of fake(use ioutil.TempFiile) build.
	BuildForce bool
	// BuildFlags flag of compile tools build command.
	BuildFlags []string

	// BuildIsNotGb workaround for not ues gb compiler.
	BuildIsNotGb bool

	// CoverFlags flags for cover command.
	CoverFlags []string
	// CoverMode mode of cover command.
	CoverMode string

	// FmtAutosave call the GoFmt command automatically at during the BufWritePre.
	FmtAutosave bool
	// FmtMode formatting mode of Fmt command.
	FmtMode string
	// FmtGoImportsLocal list packages of goimports -local flag.
	FmtGoImportsLocal []string

	// GenerateTestAllFuncs accept all functions to the GenerateTest.
	GenerateTestAllFuncs bool
	// GenerateTestExclFuncs exclude function of GenerateTest.
	GenerateTestExclFuncs string
	// GenerateTestExportedFuncs accept exported functions to the GenerateTest.
	GenerateTestExportedFuncs bool
	// GenerateTestSubTest whether the use Go subtest idiom or not.
	GenerateTestSubTest bool
	// GenerateTestParallel print tests that runs the subtests in parallel.
	GenerateTestParallel bool
	// GenerateTestTemplateDir path to custom template set.
	GenerateTestTemplateDir string
	// GenerateTestTemplateParamsPath path to custom paramters json file(s).
	GenerateTestTemplateParamsPath string

	// GuruReflection use the type reflection on GoGuru commmands.
	GuruReflection bool
	// GuruKeepCursor keep the cursor focus to source buffer instead of quickfix or locationlist.
	GuruKeepCursor map[string]bool
	// GuruJumpFirst jump the first error position on GoGuru commands.
	GuruJumpFirst bool

	// IferrAutosave call the GoIferr command automatically at during the BufWritePre.
	IferrAutosave bool

	// GolintAutosave call the GoLint command automatically at during the BufWritePost.
	GolintAutosave bool
	// GolintIgnore ignore file for lint command.
	GolintIgnore []string
	// GolintMinConfidence minimum confidence of a problem to print it
	GolintMinConfidence float64
	// GolintMode mode of golint. available value are "root", "current" and "recursive".
	GolintMode string
	// GoVetAutosave call the GoVet command automatically at during the BufWritePost.
	GoVetAutosave bool
	// GoVetFlags default flags for GoVet commands
	GoVetFlags []string
	// GoVetIgnore ignore directories for go vet command.
	GoVetIgnore []string
	// MetalinterAutosave call the GoMetaLinter command automatically at during the BufWritePre.
	MetalinterAutosave bool
	// MetalinterAutosaveTools lint tool list for MetalinterAutosave.
	MetalinterAutosaveTools []string
	// MetalinterTools lint tool list for GoMetaLinter command.
	MetalinterTools []string
	// MetalinterDeadline deadline of GoMetaLinter command timeout.
	MetalinterDeadline string
	// MetalinterSkipDir skips of lint of the directory.
	MetalinterSkipDir []string

	// RenamePrefill Enable naming prefill.
	RenamePrefill bool

	// TerminalMode open the terminal window mode.
	TerminalMode string
	// TerminalPosition open the terminal window position.
	TerminalPosition string
	// TerminalHeight open the terminal window height.
	TerminalHeight int64
	// TerminalWidth open the terminal window width.
	TerminalWidth int64
	// TerminalStopInsert workaround if users set "autocmd BufEnter term://* startinsert".
	TerminalStopInsert bool

	// TestAutosave call the GoBuild command automatically at during the BufWritePost.
	TestAutosave bool
	// TestAll enable all package test on GoTest. similar "go test ./...", but ignored vendor and testdata.
	TestAll bool
	// TestFlags test command default flags.
	TestFlags []string

	// DebugEnable Enable debugging.
	DebugEnable bool
	// DebugPprof Enable net/http/pprof debugging.
	DebugPprof bool
)

Functions

func GCPProjectID

func GCPProjectID() string

GCPProjectID return the GCP Project ID from the $GOOGLE_CLOUD_PROJECT environment variable.

func Get

func Get(v *nvim.Nvim, cfg *Config)

Get gets the user config variables and convert to global varialble.

func HasGCPProjectID

func HasGCPProjectID() (string, bool)

HasGCPProjectID reports whether the has $GOOGLE_CLOUD_PROJECT environment variable and return the GCP Project ID.

func IsDebug

func IsDebug() bool

IsDebug reports whether the debug environment.

Types

type Config

type Config struct {
	Global *Global

	Build    *build
	Cover    *cover
	Fmt      *fmt
	Generate *generate
	Guru     *guru
	Iferr    *iferr
	Lint     *lint
	Rename   *rename
	Terminal *terminal
	Test     *test

	Debug *debug
}

Config represents a config variable for nvim-go. Each type must be exported for plugin.HandleAutocmd Eval option. Also it does not support embeded type.

type Env

type Env struct {
	EnabledStackdriverProfiler   bool   `envconfig:"ENABLED_STACKDRIVER_PROFILER" default:"false"`
	EnabledStackdriverExporter   bool   `envconfig:"ENABLED_STACKDRIVER_EXPORTER" default:"false"`
	GCPProjectID                 string `envconfig:"GOOGLE_CLOUD_PROJECT"`
	GoogleApplicationCredentials string `envconfig:"GOOGLE_APPLICATION_CREDENTIALS"`
	EnabledDatadogExporter       bool   `envconfig:"ENABLED_DATADOG_EXPORTER" default:"false"`
	DatadogAgentHostname         string `envconfig:"DATADOG_AGENT_HOSTNAME" default:"127.0.0.1"`
	Debug                        bool   `envconfig:"DEBUG" default:"false"`
	LogLevel                     string `envconfig:"LOG_LEVEL" default:"info"`
}

Env represents a environment variabels for nvim-go.

func Process

func Process() Env

Process populates the specified struct based on environment variables.

func (Env) MarshalLogObject

func (e Env) MarshalLogObject(enc zapcore.ObjectEncoder) error

type Global

type Global struct {
	ChannelID     int
	ServerName    string `eval:"v:servername"`
	ErrorListType string `eval:"get(g:, 'go#global#errorlisttype', 'locationlist')"`
}

Global represents a global config variable.

Jump to

Keyboard shortcuts

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