#NEWLINE# def _build( self ) : #NEWLINE# #INDENT# 'Builds the Managed VM app locally.\n\n    Note that the go compiler must be called from within the app directory.\n    Otherwise, it returns an error like:\n    can\'t load package: package /a/b: import "/a/b": cannot import absolute path\n\n    Raises:\n      BuildError: if build fails.\n    ' #NEWLINE# logging . debug ( 'Building Go application' ) #NEWLINE# app_root = self . _module_configuration . application_root #NEWLINE# exe_name = os . path . join ( self . _work_dir , '_ah_exe' ) #NEWLINE# args = [ 'build' , '-tags' , 'appenginevm' , '-o' , exe_name ] #NEWLINE# try : #NEWLINE# #INDENT# cwd = os . getcwd ( ) #NEWLINE# os . chdir ( app_root ) #NEWLINE# ( stdout , stderr ) = _run_tool ( 'go' , args ) #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# os . chdir ( cwd ) #NEWLINE# #UNINDENT# if ( not _file_is_executable ( exe_name ) ) : #NEWLINE# #INDENT# raise go_errors . BuildError ( 'Your Go app must use "package main" and must provide a "func main". See https://cloud.google.com/appengine/docs/go/managed-vms/ for more information.' ) #NEWLINE# #UNINDENT# logging . debug ( 'Build succeeded:\n%s\n%s' , stdout , stderr ) #NEWLINE# self . _go_executable = exe_name