drep/languages/definitions/
go.rs1use crate::languages::spec::{
4 DEFAULT_TOOL_TIMEOUT_SECS, DiagnosticsStream, LanguageSupport, OutputFormat, ToolSpec,
5};
6
7pub static GOFMT: ToolSpec = ToolSpec {
12 name: "gofmt",
13 command: &["gofmt", "-l"],
14 local_paths: &[],
15 config_files: &["go.mod"],
16 config_flag: None,
17 output_format: OutputFormat::Lines,
18 diagnostics_stream: DiagnosticsStream::Stdout,
19 timeout_secs: DEFAULT_TOOL_TIMEOUT_SECS,
20 timeout_context: None,
21 establishes_compilation: false,
22 serial_in_repository: false,
23 accepts_files: true,
24};
25
26pub static GO_VET: ToolSpec = ToolSpec {
31 name: "go vet",
32 command: &["go", "vet"],
33 local_paths: &[],
34 config_files: &["go.mod"],
35 config_flag: None,
36 output_format: OutputFormat::Position,
37 diagnostics_stream: DiagnosticsStream::Stderr,
38 timeout_secs: DEFAULT_TOOL_TIMEOUT_SECS,
39 timeout_context: None,
40 establishes_compilation: true,
41 serial_in_repository: false,
42 accepts_files: true,
43};
44
45pub static GO: LanguageSupport = LanguageSupport {
47 name: "go",
48 display_name: "Go",
49 extensions: &[".go"],
50 filenames: &[],
51 filename_prefixes: &[],
52 tools: &[&GOFMT, &GO_VET],
53 conventions: &[
54 "Errors ignored rather than checked and wrapped",
55 "Goroutine leaks, and writes to a channel nobody reads",
56 "defer inside a loop, and defer that never runs",
57 "Data races on shared state without synchronisation",
58 ],
59 vendored_dirs: &["vendor"],
60};
61
62pub(crate) static FAMILY: &[&LanguageSupport] = &[&GO];