Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / coc-go-data / tools / pkg / mod / golang.org / x / tools@v0.0.0-20201028153306-37f0764111ff / internal / typesinternal / types.go
1 // Copyright 2020 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 package typesinternal
6
7 import (
8         "go/types"
9         "reflect"
10         "unsafe"
11 )
12
13 func SetUsesCgo(conf *types.Config) bool {
14         v := reflect.ValueOf(conf).Elem()
15
16         f := v.FieldByName("go115UsesCgo")
17         if !f.IsValid() {
18                 f = v.FieldByName("UsesCgo")
19                 if !f.IsValid() {
20                         return false
21                 }
22         }
23
24         addr := unsafe.Pointer(f.UnsafeAddr())
25         *(*bool)(addr) = true
26
27         return true
28 }