<commit_before>if exists("g:go_loaded_gotools")
  finish
endif
let g:go_loaded_gotools = 1

function! GoFiles()
 let out=system("go list -f $'{{range $f := .GoFiles}}{{$.Dir}}/{{$f}}\n{{end}}'")
 return out
endfunction

function! s:GoDeps()
 let out=system("go list -f $'{{range $f := .Deps}}{{$f}}\n{{end}}'")
 return out
endfunction

function! g:GoCatchErrors(out, name)
	let errors = []
	for line in split(a:out, '\n')
			let tokens = matchlist(line, '^\(.\{-}\):\(\d\+\):\s*\(.*\)')
			if !empty(tokens)
					call add(errors, {"filename": @%,
													 \"lnum":     tokens[2],
													 \"text":     tokens[3]})
			endif
	endfor
	if empty(errors)
			% | " Couldn't detect error format, output errors
	endif
	if !empty(errors)
			call setqflist(errors, 'r')
	endif
	echohl Error | echomsg a:name . " returned error" | echohl None
endfunction

function! s:GoRun(...)
  let default_makeprg = &makeprg
  if !len(a:000)
    let &makeprg = "go run " . join(split(GoFiles(), '\n'), ' ')
  else
    let &makeprg = "go run " . expand(a:1)
  endif
	make
  let &makeprg = default_makeprg
endfunction

function! s:GoInstall(...)
  let default_makeprg = &makeprg
  if !len(a:000)
    let &makeprg = "go install " . join(split(GoFiles(), '\n'), ' ')
  else
    let &makeprg = "go install " . expand(a:1)
  endif
	make
  let &makeprg = default_makeprg
endfunction

function! s:GoBuild()
  let default_makeprg = &makeprg
	let gofiles = join(split(GoFiles(), '\n'), '\ ')
  if v:shell_error
    let &makeprg = "go build"<commit_msg>Fixed GoInstall command<commit_after>if exists("g:go_loaded_gotools")
  finish
endif
let g:go_loaded_gotools = 1

function! GoFiles()
 let out=system("go list -f $'{{range $f := .GoFiles}}{{$.Dir}}/{{$f}}\n{{end}}'")
 return out
endfunction

function! s:GoDeps()
 let out=system("go list -f $'{{range $f := .Deps}}{{$f}}\n{{end}}'")
 return out
endfunction

function! g:GoCatchErrors(out, name)
	let errors = []
	for line in split(a:out, '\n')
			let tokens = matchlist(line, '^\(.\{-}\):\(\d\+\):\s*\(.*\)')
			if !empty(tokens)
					call add(errors, {"filename": @%,
													 \"lnum":     tokens[2],
													 \"text":     tokens[3]})
			endif
	endfor
	if empty(errors)
			% | " Couldn't detect error format, output errors
	endif
	if !empty(errors)
			call setqflist(errors, 'r')
	endif
	echohl Error | echomsg a:name . " returned error" | echohl None
endfunction

function! s:GoRun(...)
  let default_makeprg = &makeprg
  if !len(a:000)
    let &makeprg = "go run " . join(split(GoFiles(), '\n'), ' ')
  else
    let &makeprg = "go run " . expand(a:1)
  endif
	make
  let &makeprg = default_makeprg
endfunction

function! s:GoInstall(...)
  let default_makeprg = &makeprg
  let &makeprg = "go install " . join(a:000, ' ')
  make
  let &makeprg = default_makeprg
endfunction

function! s:GoBuild()
  let default_makeprg = &makeprg
	let gofiles = join(split(GoFiles(), '\n'), '\ ')
  if v:shell_error
    let &makeprg = "go build"
{'fraction_non_alphanumeric': 0.18368722615436467, 'fraction_numerical': 0.007077856420626896, 'mean_word_length': 3.449775112443778, 'pattern_counts': {'":': 6, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6050064', 'n_tokens_mistral': 1228, 'n_tokens_neox': 1122, 'n_words': 281}