Resolved compile-time errors since merging from v1

This commit is contained in:
Dan Buch
2017-08-04 12:00:22 -04:00
parent a61867e5e6
commit 47a412375f
11 changed files with 364 additions and 431 deletions

View File

@@ -1,7 +1,8 @@
#!/usr/bin/env python
from __future__ import print_function
from __future__ import print_function, unicode_literals
import argparse
import codecs
import glob
import os
import platform
@@ -37,7 +38,7 @@ def _target(func):
@_target
def _test():
if check_output('go version'.split()).split()[2] < 'go1.2':
if _go_version() < 'go1.2':
_run('go test -v .')
return
@@ -61,7 +62,7 @@ def _test():
@_target
def _gfmrun():
go_version = check_output('go version'.split()).split()[2]
go_version = _go_version()
if go_version < 'go1.3':
print('runtests: skip on {}'.format(go_version), file=sys.stderr)
return
@@ -75,7 +76,7 @@ def _vet():
@_target
def _migrations():
go_version = check_output('go version'.split()).split()[2]
go_version = _go_version()
if go_version < 'go1.3':
print('runtests: skip on {}'.format(go_version), file=sys.stderr)
return
@@ -115,7 +116,7 @@ def _toc():
@_target
def _gen():
go_version = check_output('go version'.split()).split()[2]
go_version = _go_version()
if go_version < 'go1.5':
print('runtests: skip on {}'.format(go_version), file=sys.stderr)
return
@@ -133,26 +134,30 @@ def _run(command):
def _gfmrun_count():
with open('README.md') as infile:
with codecs.open('README.md', 'r', 'utf-8') as infile:
lines = infile.read().splitlines()
return len(filter(_is_go_runnable, lines))
return len(list(filter(_is_go_runnable, lines)))
def _is_go_runnable(line):
return line.startswith('package main')
def _go_version():
return check_output('go version'.split()).decode('utf-8').split()[2]
def _combine_coverprofiles(coverprofiles):
combined = tempfile.NamedTemporaryFile(
suffix='.coverprofile', delete=False
)
combined.write('mode: set\n')
combined.write(b'mode: set\n')
for coverprofile in coverprofiles:
with open(coverprofile, 'r') as infile:
with codecs.open(coverprofile, 'r', 'utf-8') as infile:
for line in infile.readlines():
if not line.startswith('mode: '):
combined.write(line)
combined.write(line.encode('utf-8'))
combined.flush()
name = combined.name