10 examples of 'golang import' in Go

Every line of 'golang import' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Go code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
102func go_vm_resolve_import(vm *C.struct_VirtualMachine, moduleName *C.const_char, fieldName *C.const_char) C.ExternalFunction {
103 return C.ExternalFunction(C.go_vm_dispatch_import_invocation)
104}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

156func (im *InfraManager) Import(ctx sdk.Context, tb *model.InfraTablesIR) {
157 im.storage.Import(ctx, tb)
158}
809func (_ tStyle) Import(
810 template interface{},
811 ) string {
812 args := make(map[string]string)
813
814 revel.Unbind(args, "template", template)
815 return revel.MainRouter.Reverse("Style.Import", args).Url
816}
32func (disableImports) Import(importedFrom, importPath string) (jsonnet.Contents, string, error) {
33 return jsonnet.Contents{}, "", errors.New("jsonnet imports are disabled")
34}
25func (i *customImporter) Import(path string) (*types.Package, error) {
26 var err error
27 if path == "" || path[0] == '.' {
28 path, err = filepath.Abs(filepath.Clean(path))
29 if err != nil {
30 return nil, err
31 }
32 path = gogenutil.StripGopath(path)
33 }
34 if pkg, ok := i.imported[path]; ok {
35 return pkg, nil
36 }
37 pkg, err := i.fsPkg(path)
38 if err != nil {
39 return nil, err
40 }
41 i.imported[path] = pkg
42 return pkg, nil
43}
344func (p *Builder) Import(pkgPath string) string {
345 if name, ok := p.imports[pkgPath]; ok {
346 return name
347 }
348 name := path.Base(pkgPath)
349 if _, exists := p.importPaths[name]; exists {
350 name = "q" + strconv.Itoa(len(p.imports)) + name
351 }
352 p.imports[pkgPath] = name
353 p.importPaths[name] = pkgPath
354 return name
355}
135func (gi *gsuImporter) Import(path string) (*types.Package, error) {
136 return gi.ImportFrom(path, ".", 0)
137}
117func (m *Manager) ImportGo(path string) (*gotypes.Package, error) {
118 m.mu.Lock()
119 defer m.mu.Unlock()
120
121 if err := m.init(); err != nil {
122 return nil, err
123 }
124 if m.importerIsGlobal {
125 // Make sure our source '.a' files are fresh.
126 if err := m.gocmd("install", path); err != nil {
127 return nil, err
128 }
129 }
130 return m.importer.Import(path)
131}
170func Import(path string, namespace string) ImportItemDeclr {
171 return ImportItemDeclr{
172 Namespace: namespace,
173 Path: path,
174 }
175}
10func Import(env *vm.Env) *vm.Env {
11 m := env.NewPackage("exec")
12 m.Define("ErrNotFound", e.ErrNotFound)
13 m.Define("LookPath", e.LookPath)
14 m.Define("Command", e.Command)
15 return m
16}

Related snippets