diff --git a/.go-version b/.go-version index 587c5f0c730..ca7176690dd 100644 --- a/.go-version +++ b/.go-version @@ -1 +1 @@ -1.10.3 +1.11.2 diff --git a/CHANGELOG-developer.asciidoc b/CHANGELOG-developer.asciidoc index efe36192b0b..0d9333b69c7 100644 --- a/CHANGELOG-developer.asciidoc +++ b/CHANGELOG-developer.asciidoc @@ -68,3 +68,4 @@ The list below covers the major changes between 6.3.0 and master only. - Add `cfgwarn.CheckRemoved6xSetting(s)` to display a warning for options removed in 7.0. {pull}8909[8909] - Add docker image building to `mage.Package`. {pull}8898[8898] - Simplified exporting of dashboards. {pull}7730[7730] +- Update Beats to use go 1.11.2 {pull}8746[8746] diff --git a/NOTICE.txt b/NOTICE.txt index dcc3af7627c..b8629e99a51 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -648,7 +648,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------- Dependency: github.com/fsnotify/fsevents -Revision: 4d5197691b054c220286f7c6ea167de9753d902d +Revision: e1d381a4d27063baac2e9d3c5887ceb4ab059287 License type (autodetected): BSD-3-Clause ./vendor/github.com/fsnotify/fsevents/LICENSE: -------------------------------------------------------------------- @@ -1713,7 +1713,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI -------------------------------------------------------------------- Dependency: github.com/magefile/mage -Revision: 5e51f9ad1ed0886c5d06a8c46a09703cfc4d9034 +Revision: 11d15918ff3aa6f75cd6d3340a9507bb5309c679 License type (autodetected): Apache-2.0 ./vendor/github.com/magefile/mage/LICENSE: -------------------------------------------------------------------- @@ -2849,7 +2849,7 @@ THE SOFTWARE. -------------------------------------------------------------------- Dependency: golang.org/x/crypto -Revision: 5119cf507ed5294cc409c092980c7497ee5d6fd2 +Revision: 85e1b3f9139abd58575d728a509643924e3b2ebf License type (autodetected): BSD-3-Clause ./vendor/golang.org/x/crypto/LICENSE: -------------------------------------------------------------------- @@ -2918,7 +2918,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------- Dependency: golang.org/x/sys -Revision: 0ffbfd41fbef8ffcf9b62b0b0aa3a5873ed7a4fe +Revision: d989b31c87461dc8ab2f1cac6792814e27fadea9 License type (autodetected): BSD-3-Clause ./vendor/golang.org/x/sys/LICENSE: -------------------------------------------------------------------- diff --git a/auditbeat/Dockerfile b/auditbeat/Dockerfile index 5cfb18d46a5..77eabf4b136 100644 --- a/auditbeat/Dockerfile +++ b/auditbeat/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.10.3 +FROM golang:1.11.2 MAINTAINER Nicolas Ruflin RUN set -x && \ diff --git a/auditbeat/module/file_integrity/metricset_test.go b/auditbeat/module/file_integrity/metricset_test.go index 9f88490449f..c171deeee66 100644 --- a/auditbeat/module/file_integrity/metricset_test.go +++ b/auditbeat/module/file_integrity/metricset_test.go @@ -206,7 +206,7 @@ func TestExcludedFiles(t *testing.T) { } wanted := map[string]bool{ - dir: true, + dir: true, filepath.Join(dir, "FILE.TXT"): true, filepath.Join(dir, ".gitignore"): true, } @@ -271,7 +271,7 @@ func TestIncludedExcludedFiles(t *testing.T) { } wanted := map[string]bool{ - dir: true, + dir: true, filepath.Join(dir, ".ssh"): true, filepath.Join(dir, ".ssh/known_hosts"): true, } diff --git a/auditbeat/module/file_integrity/monitor/monitor_test.go b/auditbeat/module/file_integrity/monitor/monitor_test.go index 729184c9f2f..0b496c8e604 100644 --- a/auditbeat/module/file_integrity/monitor/monitor_test.go +++ b/auditbeat/module/file_integrity/monitor/monitor_test.go @@ -248,7 +248,7 @@ func TestRecursiveSubdirPermissions(t *testing.T) { // File "b/b" is missing because a watch to b couldn't be installed expected := map[string]fsnotify.Op{ - dest: fsnotify.Create, + dest: fsnotify.Create, filepath.Join(dest, "a"): fsnotify.Create, filepath.Join(dest, "a/a"): fsnotify.Create, filepath.Join(dest, "b"): fsnotify.Create, diff --git a/filebeat/Dockerfile b/filebeat/Dockerfile index 990d129eea0..6bc6144156c 100644 --- a/filebeat/Dockerfile +++ b/filebeat/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.10.3 +FROM golang:1.11.2 RUN \ apt-get update \ diff --git a/filebeat/autodiscover/builder/hints/logs.go b/filebeat/autodiscover/builder/hints/logs.go index 9b7d236e86a..9c74d999700 100644 --- a/filebeat/autodiscover/builder/hints/logs.go +++ b/filebeat/autodiscover/builder/hints/logs.go @@ -185,7 +185,7 @@ func (l *logHints) getFilesets(hints common.MapStr, module string) map[string]*f moduleFilesets, err := l.Registry.ModuleFilesets(module) if err != nil { - logp.Err("Error retrieving module filesets", err) + logp.Err("Error retrieving module filesets: %+v", err) return nil } diff --git a/filebeat/input/log/input.go b/filebeat/input/log/input.go index afba5fb4220..875c3a6b104 100644 --- a/filebeat/input/log/input.go +++ b/filebeat/input/log/input.go @@ -510,7 +510,7 @@ func (p *Input) harvestExistingFile(newState file.State, oldState file.State) { // File size was reduced -> truncated file if oldState.Finished && newState.Fileinfo.Size() < oldState.Offset { - logp.Debug("input", "Old file was truncated. Starting from the beginning: %s, offset: %d, new size: %d ", newState.Source, newState.Fileinfo.Size()) + logp.Debug("input", "Old file was truncated. Starting from the beginning: %s, offset: %d, new size: %d ", newState.Source, newState.Offset, newState.Fileinfo.Size()) err := p.startHarvester(newState, 0) if err != nil { logp.Err("Harvester could not be started on truncated file: %s, Err: %s", newState.Source, err) diff --git a/generator/beat/{beat}/.travis.yml b/generator/beat/{beat}/.travis.yml index 0138ce5b670..88c5ee623a2 100644 --- a/generator/beat/{beat}/.travis.yml +++ b/generator/beat/{beat}/.travis.yml @@ -6,7 +6,7 @@ services: language: go go: - - 1.10.3 + - 1.11.2 os: - linux diff --git a/heartbeat/Dockerfile b/heartbeat/Dockerfile index 222f4944ba8..89272c54c6c 100644 --- a/heartbeat/Dockerfile +++ b/heartbeat/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.10.3 +FROM golang:1.11.2 MAINTAINER Nicolas Ruflin RUN set -x && \ diff --git a/journalbeat/Dockerfile b/journalbeat/Dockerfile index 975fce8f382..7e187972feb 100644 --- a/journalbeat/Dockerfile +++ b/journalbeat/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.10.3 +FROM golang:1.11.2 MAINTAINER Noémi Ványi RUN set -x && \ diff --git a/journalbeat/checkpoint/file_windows.go b/journalbeat/checkpoint/file_windows.go index 6644d751096..267086398f3 100644 --- a/journalbeat/checkpoint/file_windows.go +++ b/journalbeat/checkpoint/file_windows.go @@ -45,8 +45,8 @@ func createWriteThroughFile(path string) (*os.File, error) { pathp, // Path syscall.GENERIC_READ|syscall.GENERIC_WRITE, // Access Mode uint32(syscall.FILE_SHARE_READ|syscall.FILE_SHARE_WRITE), // Share Mode - nil, // Security Attributes - syscall.CREATE_ALWAYS, // Create Mode + nil, // Security Attributes + syscall.CREATE_ALWAYS, // Create Mode uint32(syscall.FILE_ATTRIBUTE_NORMAL|_FILE_FLAG_WRITE_THROUGH), // Flags and Attributes 0) // Template File diff --git a/libbeat/Dockerfile b/libbeat/Dockerfile index 4c9a303bd4d..9e1c4ec4d0e 100644 --- a/libbeat/Dockerfile +++ b/libbeat/Dockerfile @@ -1,5 +1,5 @@ # Beats dockerfile used for testing -FROM golang:1.10.3 +FROM golang:1.11.2 MAINTAINER Nicolas Ruflin RUN set -x && \ diff --git a/libbeat/autodiscover/appenders/config/config.go b/libbeat/autodiscover/appenders/config/config.go index 070d5380689..d95e6c7bbd4 100644 --- a/libbeat/autodiscover/appenders/config/config.go +++ b/libbeat/autodiscover/appenders/config/config.go @@ -56,7 +56,7 @@ func NewConfigAppender(cfg *common.Config) (autodiscover.Appender, error) { confs := configs{} err := cfg.Unpack(&confs) if err != nil { - return nil, fmt.Errorf("unable to unpack config appender due to error: %v", err) + return nil, fmt.Errorf("unable to unpack config appender due to error: %+v", err) } var configMaps []configMap @@ -66,7 +66,7 @@ func NewConfigAppender(cfg *common.Config) (autodiscover.Appender, error) { if conf.ConditionConfig != nil { cond, err = conditions.NewCondition(conf.ConditionConfig) if err != nil { - logp.Warn("config", "unable to create condition due to error: %v", err) + logp.Warn("unable to create condition due to error: %+v", err) continue } } @@ -76,7 +76,7 @@ func NewConfigAppender(cfg *common.Config) (autodiscover.Appender, error) { cf := common.MapStr{} err = conf.Config.Unpack(&cf) if err != nil { - logp.Warn("config", "unable to unpack config due to error: %v", err) + logp.Warn("unable to unpack config due to error: %+v", err) continue } cm.config = cf diff --git a/libbeat/autodiscover/autodiscover.go b/libbeat/autodiscover/autodiscover.go index 695f02567d9..28afd967680 100644 --- a/libbeat/autodiscover/autodiscover.go +++ b/libbeat/autodiscover/autodiscover.go @@ -225,7 +225,7 @@ func (a *Autodiscover) handleStop(event bus.Event) bool { delete(a.configs, hash) updated = true } else { - logp.Debug(debugK, "Runner not found for stopping: %s", hash) + logp.Debug(debugK, "Runner not found for stopping: %d", hash) } } diff --git a/libbeat/autodiscover/providers/jolokia/discovery.go b/libbeat/autodiscover/providers/jolokia/discovery.go index fc704dafb16..6492ab44151 100644 --- a/libbeat/autodiscover/providers/jolokia/discovery.go +++ b/libbeat/autodiscover/providers/jolokia/discovery.go @@ -192,7 +192,7 @@ var queryMessage = []byte(`{"type":"query"}`) func (d *Discovery) sendProbe(config InterfaceConfig) { interfaces, err := d.interfaces(config.Name) if err != nil { - logp.Err("failed to get interfaces: ", err) + logp.Err("failed to get interfaces: %+v", err) return } diff --git a/libbeat/autodiscover/providers/kubernetes/kubernetes.go b/libbeat/autodiscover/providers/kubernetes/kubernetes.go index c2f3b133c93..7f35e522295 100644 --- a/libbeat/autodiscover/providers/kubernetes/kubernetes.go +++ b/libbeat/autodiscover/providers/kubernetes/kubernetes.go @@ -73,7 +73,7 @@ func AutodiscoverBuilder(bus bus.Bus, c *common.Config) (autodiscover.Provider, Namespace: config.Namespace, }) if err != nil { - logp.Err("kubernetes: Couldn't create watcher for %t", &kubernetes.Pod{}) + logp.Err("kubernetes: Couldn't create watcher for %T", &kubernetes.Pod{}) return nil, err } diff --git a/libbeat/common/kubernetes/util.go b/libbeat/common/kubernetes/util.go index eb4654143d3..38ee7c8c6a3 100644 --- a/libbeat/common/kubernetes/util.go +++ b/libbeat/common/kubernetes/util.go @@ -75,19 +75,19 @@ func DiscoverKubernetesNode(host string, inCluster bool, client *k8s.Client) (no if inCluster { ns, err := inClusterNamespace() if err != nil { - logp.Err("kubernetes: Couldn't get namespace when beat is in cluster with error: ", err.Error()) + logp.Err("kubernetes: Couldn't get namespace when beat is in cluster with error: %+v", err.Error()) return defaultNode } podName, err := os.Hostname() if err != nil { - logp.Err("kubernetes: Couldn't get hostname as beat pod name in cluster with error: ", err.Error()) + logp.Err("kubernetes: Couldn't get hostname as beat pod name in cluster with error: %+v", err.Error()) return defaultNode } logp.Info("kubernetes: Using pod name %s and namespace %s to discover kubernetes node", podName, ns) pod := v1.Pod{} err = client.Get(context.TODO(), ns, podName, &pod) if err != nil { - logp.Err("kubernetes: Querying for pod failed with error: %v", err.Error()) + logp.Err("kubernetes: Querying for pod failed with error: %+v", err.Error()) return defaultNode } logp.Info("kubernetes: Using node %s discovered by in cluster pod node query", pod.Spec.GetNodeName()) @@ -103,7 +103,7 @@ func DiscoverKubernetesNode(host string, inCluster bool, client *k8s.Client) (no nodes := v1.NodeList{} err := client.List(context.TODO(), k8s.AllNamespaces, &nodes) if err != nil { - logp.Err("kubernetes: Querying for nodes failed with error: ", err.Error()) + logp.Err("kubernetes: Querying for nodes failed with error: %+v", err.Error()) return defaultNode } for _, n := range nodes.Items { diff --git a/libbeat/common/transport/tlscommon/tls.go b/libbeat/common/transport/tlscommon/tls.go index 6fe79e8df1d..43eb371cdb2 100644 --- a/libbeat/common/transport/tlscommon/tls.go +++ b/libbeat/common/transport/tlscommon/tls.go @@ -48,19 +48,19 @@ func LoadCertificate(config *CertificateConfig) (*tls.Certificate, error) { certPEM, err := ReadPEMFile(certificate, config.Passphrase) if err != nil { - logp.Critical("Failed reading certificate file %v: %v", certificate, err) + logp.Critical("Failed reading certificate file %v: %+v", certificate, err) return nil, fmt.Errorf("%v %v", err, certificate) } keyPEM, err := ReadPEMFile(key, config.Passphrase) if err != nil { - logp.Critical("Failed reading key file %v: %v", key, err) + logp.Critical("Failed reading key file %v: %+v", key, err) return nil, fmt.Errorf("%v %v", err, key) } cert, err := tls.X509KeyPair(certPEM, keyPEM) if err != nil { - logp.Critical("Failed loading client certificate", err) + logp.Critical("Failed loading client certificate %+v", err) return nil, err } diff --git a/libbeat/docs/version.asciidoc b/libbeat/docs/version.asciidoc index 2874d8bccca..d16c330f597 100644 --- a/libbeat/docs/version.asciidoc +++ b/libbeat/docs/version.asciidoc @@ -1,6 +1,6 @@ :stack-version: 7.0.0-alpha1 :doc-branch: master -:go-version: 1.10.3 +:go-version: 1.11.2 :release-state: prerelease :python: 2.7.9 :docker: 1.12 diff --git a/libbeat/generator/fields/validate/mapping.go b/libbeat/generator/fields/validate/mapping.go index 4a9e03079d9..a364511a0c9 100644 --- a/libbeat/generator/fields/validate/mapping.go +++ b/libbeat/generator/fields/validate/mapping.go @@ -198,7 +198,7 @@ func recursiveFattenFields(fields interface{}, prefix Prefix, mapping *Mapping, if hasRequired { required, ok = requiredIf.(bool) if !ok { - return errors.Errorf("field [%s](%s) has 'required' property but is not a boolean, but %T (value=%v)", requiredIf, requiredIf) + return errors.Errorf("field [%s](%s) has 'required' property but is not a boolean, but %T (value=%v)", key, prefix, requiredIf, requiredIf) } } @@ -235,7 +235,7 @@ func recursiveFattenFields(fields interface{}, prefix Prefix, mapping *Mapping, if fieldsIf != nil { innerFields, ok := fieldsIf.([]interface{}) if !ok { - return errors.Errorf("field [%s](%s) has a 'fields' tag of unexpected type (type=%T value=%v)", nameIf, nameIf) + return errors.Errorf("field [%s](%s) has a 'fields' tag of unexpected type (type=%T value=%v)", key, prefix, nameIf, nameIf) } for _, field := range innerFields { if err := recursiveFattenFields(field, prefix, mapping, key); err != nil { diff --git a/libbeat/kibana/fields_transformer.go b/libbeat/kibana/fields_transformer.go index 8f4f7005a38..581f4bcb1e8 100644 --- a/libbeat/kibana/fields_transformer.go +++ b/libbeat/kibana/fields_transformer.go @@ -41,7 +41,7 @@ func newFieldsTransformer(version *common.Version, fields common.Fields) (*field version: version, transformedFields: []common.MapStr{}, transformedFieldFormatMap: common.MapStr{}, - keys: common.MapStr{}, + keys: common.MapStr{}, }, nil } diff --git a/libbeat/outputs/elasticsearch/client.go b/libbeat/outputs/elasticsearch/client.go index 308767b1eaa..83bf3fe83a5 100644 --- a/libbeat/outputs/elasticsearch/client.go +++ b/libbeat/outputs/elasticsearch/client.go @@ -761,7 +761,7 @@ func (conn *Connection) execRequest( ) (int, []byte, error) { req, err := http.NewRequest(method, url, body) if err != nil { - logp.Warn("Failed to create request", err) + logp.Warn("Failed to create request %+v", err) return 0, nil, err } if body != nil { diff --git a/libbeat/outputs/transport/transptest/testing.go b/libbeat/outputs/transport/transptest/testing.go index f657b173278..402be992d1d 100644 --- a/libbeat/outputs/transport/transptest/testing.go +++ b/libbeat/outputs/transport/transptest/testing.go @@ -236,7 +236,7 @@ func GenCertForTestingPurpose(t *testing.T, host, name, keyPassword string) erro NotAfter: time.Now().AddDate(10, 0, 0), SubjectKeyId: []byte("12345"), BasicConstraintsValid: true, - IsCA: true, + IsCA: true, ExtKeyUsage: []x509.ExtKeyUsage{ x509.ExtKeyUsageClientAuth, x509.ExtKeyUsageServerAuth}, diff --git a/libbeat/plugin/cli.go b/libbeat/plugin/cli.go index 6171bef7e6b..425b2b42934 100644 --- a/libbeat/plugin/cli.go +++ b/libbeat/plugin/cli.go @@ -39,7 +39,7 @@ func (p *pluginList) String() string { func (p *pluginList) Set(v string) error { for _, path := range p.paths { if path == v { - logp.Warn("%s is already a registered plugin") + logp.Warn("%s is already a registered plugin", path) return nil } } diff --git a/libbeat/processors/add_kubernetes_metadata/kubernetes.go b/libbeat/processors/add_kubernetes_metadata/kubernetes.go index 63915e4b6ea..414d98b0b44 100644 --- a/libbeat/processors/add_kubernetes_metadata/kubernetes.go +++ b/libbeat/processors/add_kubernetes_metadata/kubernetes.go @@ -103,7 +103,7 @@ func newKubernetesAnnotator(cfg *common.Config) (processors.Processor, error) { config.Host = kubernetes.DiscoverKubernetesNode(config.Host, config.InCluster, client) - logp.Debug("kubernetes", "Using host ", config.Host) + logp.Debug("kubernetes", "Using host: %s", config.Host) logp.Debug("kubernetes", "Initializing watcher") watcher, err := kubernetes.NewWatcher(client, &kubernetes.Pod{}, kubernetes.WatchOptions{ @@ -112,7 +112,7 @@ func newKubernetesAnnotator(cfg *common.Config) (processors.Processor, error) { Namespace: config.Namespace, }) if err != nil { - logp.Err("kubernetes: Couldn't create watcher for %t", &kubernetes.Pod{}) + logp.Err("kubernetes: Couldn't create watcher for %T", &kubernetes.Pod{}) return nil, err } diff --git a/libbeat/reader/readfile/line.go b/libbeat/reader/readfile/line.go index be2714b498f..07e8590b02e 100644 --- a/libbeat/reader/readfile/line.go +++ b/libbeat/reader/readfile/line.go @@ -87,7 +87,7 @@ func (r *LineReader) Next() ([]byte, int, error) { if buf[len(buf)-1] == '\n' { break } else { - logp.Debug("line", "Line ending char found which wasn't one: %s", buf[len(buf)-1]) + logp.Debug("line", "Line ending char found which wasn't one: %c", buf[len(buf)-1]) } } diff --git a/metricbeat/Dockerfile b/metricbeat/Dockerfile index 8ab5e06e414..d3a67163ee3 100644 --- a/metricbeat/Dockerfile +++ b/metricbeat/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.10.3 +FROM golang:1.11.2 MAINTAINER Nicolas Ruflin RUN set -x && \ diff --git a/metricbeat/module/ceph/cluster_disk/data.go b/metricbeat/module/ceph/cluster_disk/data.go index d4245aa89af..7a2c600cc53 100644 --- a/metricbeat/module/ceph/cluster_disk/data.go +++ b/metricbeat/module/ceph/cluster_disk/data.go @@ -43,7 +43,7 @@ func eventMapping(content []byte) common.MapStr { var d DfRequest err := json.Unmarshal(content, &d) if err != nil { - logp.Err("Error: ", err) + logp.Err("Error: %+v", err) } return common.MapStr{ diff --git a/metricbeat/module/ceph/cluster_health/data.go b/metricbeat/module/ceph/cluster_health/data.go index e2dd642ebb2..10ecfbcd389 100644 --- a/metricbeat/module/ceph/cluster_health/data.go +++ b/metricbeat/module/ceph/cluster_health/data.go @@ -44,7 +44,7 @@ func eventMapping(content []byte) common.MapStr { var d HealthRequest err := json.Unmarshal(content, &d) if err != nil { - logp.Err("Error: ", err) + logp.Err("Error: %+v", err) } return common.MapStr{ diff --git a/metricbeat/module/ceph/cluster_status/data.go b/metricbeat/module/ceph/cluster_status/data.go index ad49607a9cf..55a860281b0 100644 --- a/metricbeat/module/ceph/cluster_status/data.go +++ b/metricbeat/module/ceph/cluster_status/data.go @@ -81,7 +81,7 @@ func eventsMapping(content []byte) ([]common.MapStr, error) { var d HealthRequest err := json.Unmarshal(content, &d) if err != nil { - logp.Err("Error: ", err) + logp.Err("Error: %+v", err) return nil, err } diff --git a/metricbeat/module/ceph/monitor_health/data.go b/metricbeat/module/ceph/monitor_health/data.go index aa461e74ac7..c4ed630c385 100644 --- a/metricbeat/module/ceph/monitor_health/data.go +++ b/metricbeat/module/ceph/monitor_health/data.go @@ -89,7 +89,7 @@ func eventsMapping(content []byte) []common.MapStr { var d HealthRequest err := json.Unmarshal(content, &d) if err != nil { - logp.Err("Error: ", err) + logp.Err("Error: %+v", err) } events := []common.MapStr{} diff --git a/metricbeat/module/ceph/osd_df/data.go b/metricbeat/module/ceph/osd_df/data.go index 2e341fb99da..b22d1dd593a 100644 --- a/metricbeat/module/ceph/osd_df/data.go +++ b/metricbeat/module/ceph/osd_df/data.go @@ -47,7 +47,7 @@ func eventsMapping(content []byte) ([]common.MapStr, error) { var d OsdDfRequest err := json.Unmarshal(content, &d) if err != nil { - logp.Err("Error: ", err) + logp.Err("Error: %+v", err) return nil, err } diff --git a/metricbeat/module/ceph/osd_tree/data.go b/metricbeat/module/ceph/osd_tree/data.go index 25dee1840be..27a3ea14278 100644 --- a/metricbeat/module/ceph/osd_tree/data.go +++ b/metricbeat/module/ceph/osd_tree/data.go @@ -55,7 +55,7 @@ func eventsMapping(content []byte) ([]common.MapStr, error) { var d OsdTreeRequest err := json.Unmarshal(content, &d) if err != nil { - logp.Err("Error: ", err) + logp.Err("Error: %+v", err) return nil, err } diff --git a/metricbeat/module/ceph/pool_disk/data.go b/metricbeat/module/ceph/pool_disk/data.go index 6a89f0d4210..7dba27044c6 100644 --- a/metricbeat/module/ceph/pool_disk/data.go +++ b/metricbeat/module/ceph/pool_disk/data.go @@ -50,7 +50,7 @@ func eventsMapping(content []byte) []common.MapStr { var d DfRequest err := json.Unmarshal(content, &d) if err != nil { - logp.Err("Error: ", err) + logp.Err("Error: %+v", err) } events := []common.MapStr{} diff --git a/metricbeat/module/couchbase/bucket/data.go b/metricbeat/module/couchbase/bucket/data.go index 95fd950eead..432bcf38cd8 100644 --- a/metricbeat/module/couchbase/bucket/data.go +++ b/metricbeat/module/couchbase/bucket/data.go @@ -50,7 +50,7 @@ func eventsMapping(content []byte) []common.MapStr { var d Buckets err := json.Unmarshal(content, &d) if err != nil { - logp.Err("Error: ", err) + logp.Err("Error: %+v", err) } events := []common.MapStr{} diff --git a/metricbeat/module/couchbase/cluster/data.go b/metricbeat/module/couchbase/cluster/data.go index 064160f2672..e099c3e5a9f 100644 --- a/metricbeat/module/couchbase/cluster/data.go +++ b/metricbeat/module/couchbase/cluster/data.go @@ -61,7 +61,7 @@ func eventMapping(content []byte) common.MapStr { var d Data err := json.Unmarshal(content, &d) if err != nil { - logp.Err("Error: ", err) + logp.Err("Error: %+v", err) } logp.Info("Printing Data:") diff --git a/metricbeat/module/couchbase/node/data.go b/metricbeat/module/couchbase/node/data.go index 990887a2a87..046226bce5f 100644 --- a/metricbeat/module/couchbase/node/data.go +++ b/metricbeat/module/couchbase/node/data.go @@ -77,7 +77,7 @@ func eventsMapping(content []byte) []common.MapStr { var d Data err := json.Unmarshal(content, &d) if err != nil { - logp.Err("Error: ", err) + logp.Err("Error: %+v", err) } events := []common.MapStr{} diff --git a/metricbeat/module/elasticsearch/elasticsearch_integration_test.go b/metricbeat/module/elasticsearch/elasticsearch_integration_test.go index ccd7084a313..ee99b790620 100644 --- a/metricbeat/module/elasticsearch/elasticsearch_integration_test.go +++ b/metricbeat/module/elasticsearch/elasticsearch_integration_test.go @@ -127,9 +127,9 @@ func getEnvPort() string { // GetConfig returns config for elasticsearch module func getConfig(metricset string) map[string]interface{} { return map[string]interface{}{ - "module": elasticsearch.ModuleName, - "metricsets": []string{metricset}, - "hosts": []string{getEnvHost() + ":" + getEnvPort()}, + "module": elasticsearch.ModuleName, + "metricsets": []string{metricset}, + "hosts": []string{getEnvHost() + ":" + getEnvPort()}, "index_recovery.active_only": false, } } diff --git a/metricbeat/module/envoyproxy/server/data.go b/metricbeat/module/envoyproxy/server/data.go index 07f49a71464..16688ce75d2 100644 --- a/metricbeat/module/envoyproxy/server/data.go +++ b/metricbeat/module/envoyproxy/server/data.go @@ -65,16 +65,16 @@ var ( }, "server": s.Object{ "days_until_first_cert_expiring": c.Int("days_until_first_cert_expiring"), - "live": c.Int("live"), - "memory_allocated": c.Int("memory_allocated"), - "memory_heap_size": c.Int("memory_heap_size"), - "parent_connections": c.Int("parent_connections"), - "total_connections": c.Int("total_connections"), - "uptime": c.Int("uptime"), - "version": c.Int("version"), - "watchdog_mega_miss": c.Int("watchdog_mega_miss", s.Optional), - "watchdog_miss": c.Int("watchdog_miss", s.Optional), - "hot_restart_epoch": c.Int("hot_restart_epoch", s.Optional), + "live": c.Int("live"), + "memory_allocated": c.Int("memory_allocated"), + "memory_heap_size": c.Int("memory_heap_size"), + "parent_connections": c.Int("parent_connections"), + "total_connections": c.Int("total_connections"), + "uptime": c.Int("uptime"), + "version": c.Int("version"), + "watchdog_mega_miss": c.Int("watchdog_mega_miss", s.Optional), + "watchdog_miss": c.Int("watchdog_miss", s.Optional), + "hot_restart_epoch": c.Int("hot_restart_epoch", s.Optional), }, "http2": s.Object{ "header_overflow": c.Int("header_overflow", s.Optional), diff --git a/metricbeat/module/http/_meta/Dockerfile b/metricbeat/module/http/_meta/Dockerfile index d67abee2cd0..6a3fe8a18ac 100644 --- a/metricbeat/module/http/_meta/Dockerfile +++ b/metricbeat/module/http/_meta/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.10.3 +FROM golang:1.11.2 COPY test/main.go main.go diff --git a/metricbeat/module/rabbitmq/connection/data.go b/metricbeat/module/rabbitmq/connection/data.go index b4ee6d20a44..68e2c15964a 100644 --- a/metricbeat/module/rabbitmq/connection/data.go +++ b/metricbeat/module/rabbitmq/connection/data.go @@ -60,7 +60,7 @@ func eventsMapping(content []byte) ([]common.MapStr, error) { var connections []map[string]interface{} err := json.Unmarshal(content, &connections) if err != nil { - logp.Err("Error: ", err) + logp.Err("Error: %+v", err) return nil, err } diff --git a/metricbeat/module/rabbitmq/exchange/data.go b/metricbeat/module/rabbitmq/exchange/data.go index 72e869fb595..a322bb8a8de 100644 --- a/metricbeat/module/rabbitmq/exchange/data.go +++ b/metricbeat/module/rabbitmq/exchange/data.go @@ -59,7 +59,7 @@ func eventsMapping(content []byte) ([]common.MapStr, error) { var exchanges []map[string]interface{} err := json.Unmarshal(content, &exchanges) if err != nil { - logp.Err("Error: ", err) + logp.Err("Error: %+v", err) return nil, err } diff --git a/metricbeat/module/rabbitmq/queue/data.go b/metricbeat/module/rabbitmq/queue/data.go index 56b977eab12..5b98742c88d 100644 --- a/metricbeat/module/rabbitmq/queue/data.go +++ b/metricbeat/module/rabbitmq/queue/data.go @@ -87,7 +87,7 @@ func eventsMapping(content []byte) ([]common.MapStr, error) { var queues []map[string]interface{} err := json.Unmarshal(content, &queues) if err != nil { - logp.Err("Error: ", err) + logp.Err("Error: %+v", err) return nil, err } diff --git a/metricbeat/module/uwsgi/status/data.go b/metricbeat/module/uwsgi/status/data.go index dc94f0530ef..26bc46a0e01 100644 --- a/metricbeat/module/uwsgi/status/data.go +++ b/metricbeat/module/uwsgi/status/data.go @@ -79,7 +79,7 @@ func eventsMapping(content []byte) ([]common.MapStr, error) { var stats uwsgiStat err := json.Unmarshal(content, &stats) if err != nil { - logp.Err("uwsgi statistics parsing failed with error: ", err) + logp.Err("uwsgi statistics parsing failed with error: %+v", err) return nil, err } diff --git a/metricbeat/module/uwsgi/status/status.go b/metricbeat/module/uwsgi/status/status.go index 5bd9ef8bcf8..efb88dec987 100644 --- a/metricbeat/module/uwsgi/status/status.go +++ b/metricbeat/module/uwsgi/status/status.go @@ -57,7 +57,7 @@ func fetchStatData(URL string) ([]byte, error) { u, err := url.Parse(URL) if err != nil { - logp.Err("parsing uwsgi stats url failed: ", err) + logp.Err("parsing uwsgi stats url failed: %+v", err) return nil, err } @@ -85,7 +85,7 @@ func fetchStatData(URL string) ([]byte, error) { defer res.Body.Close() if res.StatusCode != 200 { - logp.Err("failed to fetch uwsgi status with code: ", res.StatusCode) + logp.Err("failed to fetch uwsgi status with code: %d", res.StatusCode) return nil, errors.New("http failed") } reader = res.Body @@ -95,7 +95,7 @@ func fetchStatData(URL string) ([]byte, error) { data, err := ioutil.ReadAll(reader) if err != nil { - logp.Err("uwsgi data read failed: ", err) + logp.Err("uwsgi data read failed: %+v", err) return nil, err } diff --git a/packetbeat/protos/http/http_test.go b/packetbeat/protos/http/http_test.go index 9318bfb4358..7033b9e6539 100644 --- a/packetbeat/protos/http/http_test.go +++ b/packetbeat/protos/http/http_test.go @@ -720,7 +720,7 @@ func TestEatBodyChunkedWaitCRLF(t *testing.T) { t.Error("Unexpected state", st.parseState) } - logp.Debug("http", "parseOffset", st.parseOffset) + logp.Debug("http", "parseOffset: %d", st.parseOffset) ok, complete = parser.parseBodyChunkedWaitFinalCRLF(st, msg) if ok != true || complete != false { diff --git a/packetbeat/protos/icmp/icmp.go b/packetbeat/protos/icmp/icmp.go index 00740290708..b64de3852fa 100644 --- a/packetbeat/protos/icmp/icmp.go +++ b/packetbeat/protos/icmp/icmp.go @@ -94,7 +94,7 @@ func (icmp *icmpPlugin) init(results protos.Reporter, config *icmpConfig) error var err error icmp.localIps, err = common.LocalIPAddrs() if err != nil { - logp.Err("icmp", "Error getting local IP addresses: %s", err) + logp.Err("Error getting local IP addresses: %+v", err) icmp.localIps = []net.IP{} } logp.Debug("icmp", "Local IP addresses: %s", icmp.localIps) diff --git a/packetbeat/protos/icmp/message.go b/packetbeat/protos/icmp/message.go index ec1c9181a22..0a8b857c2df 100644 --- a/packetbeat/protos/icmp/message.go +++ b/packetbeat/protos/icmp/message.go @@ -90,7 +90,7 @@ func isRequest(tuple *icmpTuple, msg *icmpMessage) bool { if tuple.icmpVersion == 6 { return !icmp6ResponseTypes[msg.Type] } - logp.WTF("icmp", "Invalid ICMP version[%d]", tuple.icmpVersion) + logp.WTF("Invalid ICMP version[%d]", tuple.icmpVersion) return true } @@ -101,7 +101,7 @@ func isError(tuple *icmpTuple, msg *icmpMessage) bool { if tuple.icmpVersion == 6 { return icmp6ErrorTypes[msg.Type] } - logp.WTF("icmp", "Invalid ICMP version[%d]", tuple.icmpVersion) + logp.WTF("Invalid ICMP version[%d]", tuple.icmpVersion) return true } @@ -112,7 +112,7 @@ func requiresCounterpart(tuple *icmpTuple, msg *icmpMessage) bool { if tuple.icmpVersion == 6 { return icmp6PairTypes[msg.Type] } - logp.WTF("icmp", "Invalid ICMP version[%d]", tuple.icmpVersion) + logp.WTF("Invalid ICMP version[%d]", tuple.icmpVersion) return false } @@ -133,7 +133,7 @@ func extractTrackingData(icmpVersion uint8, msgType uint8, baseLayer *layers.Bas } return 0, 0 } - logp.WTF("icmp", "Invalid ICMP version[%d]", icmpVersion) + logp.WTF("Invalid ICMP version[%d]", icmpVersion) return 0, 0 } @@ -144,6 +144,6 @@ func humanReadable(tuple *icmpTuple, msg *icmpMessage) string { if tuple.icmpVersion == 6 { return layers.ICMPv6TypeCode(binary.BigEndian.Uint16([]byte{msg.Type, msg.code})).String() } - logp.WTF("icmp", "Invalid ICMP version[%d]", tuple.icmpVersion) + logp.WTF("Invalid ICMP version[%d]", tuple.icmpVersion) return "" } diff --git a/packetbeat/protos/mysql/mysql.go b/packetbeat/protos/mysql/mysql.go index 89bd0221a77..38e6959e940 100644 --- a/packetbeat/protos/mysql/mysql.go +++ b/packetbeat/protos/mysql/mysql.go @@ -801,7 +801,7 @@ func (mysql *mysqlPlugin) parseMysqlResponse(data []byte) ([]string, [][]string) var complete bool text, off, complete, err = readLstring(data, off) if err != nil || !complete { - logp.Debug("mysql", "Error parsing rows: %s %b", err, complete) + logp.Debug("mysql", "Error parsing rows: %+v %t", err, complete) // nevertheless, return what we have so far return fields, rows } diff --git a/packetbeat/protos/thrift/thrift_idl.go b/packetbeat/protos/thrift/thrift_idl.go index dd4ecc4279e..8d4d891bc86 100644 --- a/packetbeat/protos/thrift/thrift_idl.go +++ b/packetbeat/protos/thrift/thrift_idl.go @@ -68,7 +68,7 @@ func buildMethodsMap(thriftFiles map[string]parser.Thrift) map[string]*thriftIdl for _, method := range service.Methods { if _, exists := output[method.Name]; exists { logp.Warn("Thrift IDL: Method %s is defined in more services: %s and %s", - output[method.Name].service.Name, service.Name) + method.Name, output[method.Name].service.Name, service.Name) } output[method.Name] = &thriftIdlMethod{ service: service, diff --git a/vendor/github.com/fsnotify/fsevents/go_1_10_after.go b/vendor/github.com/fsnotify/fsevents/go_1_10_after.go new file mode 100644 index 00000000000..db7824c6691 --- /dev/null +++ b/vendor/github.com/fsnotify/fsevents/go_1_10_after.go @@ -0,0 +1,27 @@ +// +build darwin,go1.10 + +package fsevents + +/* +#include +*/ +import "C" + +const ( + nullCFStringRef = C.CFStringRef(0) + nullCFUUIDRef = C.CFUUIDRef(0) +) + +// NOTE: The following code is identical between go_1_10_after and go_1_10_before, +// however versions of Go 1.10.x prior to 1.10.4 fail to compile when the code utilizing +// the above constants is in a different file (wrap.go). + +// GetDeviceUUID retrieves the UUID required to identify an EventID +// in the FSEvents database +func GetDeviceUUID(deviceID int32) string { + uuid := C.FSEventsCopyUUIDForDevice(C.dev_t(deviceID)) + if uuid == nullCFUUIDRef { + return "" + } + return cfStringToGoString(C.CFUUIDCreateString(C.kCFAllocatorDefault, uuid)) +} diff --git a/vendor/github.com/fsnotify/fsevents/go_1_10_before.go b/vendor/github.com/fsnotify/fsevents/go_1_10_before.go new file mode 100644 index 00000000000..4ddd444130a --- /dev/null +++ b/vendor/github.com/fsnotify/fsevents/go_1_10_before.go @@ -0,0 +1,25 @@ +// +build darwin,!go1.10 + +package fsevents + +/* +#include +*/ +import "C" + +var ( + nullCFStringRef = C.CFStringRef(nil) + nullCFUUIDRef = C.CFUUIDRef(nil) +) + +// NOTE: The following code is identical between go_1_10_after and go_1_10_before. + +// GetDeviceUUID retrieves the UUID required to identify an EventID +// in the FSEvents database +func GetDeviceUUID(deviceID int32) string { + uuid := C.FSEventsCopyUUIDForDevice(C.dev_t(deviceID)) + if uuid == nullCFUUIDRef { + return "" + } + return cfStringToGoString(C.CFUUIDCreateString(C.kCFAllocatorDefault, uuid)) +} diff --git a/vendor/github.com/fsnotify/fsevents/go_1_9_2_after.go b/vendor/github.com/fsnotify/fsevents/go_1_9_2_after.go new file mode 100644 index 00000000000..4164f9c7e91 --- /dev/null +++ b/vendor/github.com/fsnotify/fsevents/go_1_9_2_after.go @@ -0,0 +1,11 @@ +// +build darwin,go1.9.2 + +package fsevents + +/* +#include +*/ +import "C" + +// eventIDSinceNow is a sentinel to begin watching events "since now". +const eventIDSinceNow = uint64(C.kFSEventStreamEventIdSinceNow) diff --git a/vendor/github.com/fsnotify/fsevents/go_1_9_2_before.go b/vendor/github.com/fsnotify/fsevents/go_1_9_2_before.go new file mode 100644 index 00000000000..e1806e97c93 --- /dev/null +++ b/vendor/github.com/fsnotify/fsevents/go_1_9_2_before.go @@ -0,0 +1,13 @@ +// +build darwin,!go1.9.2 + +package fsevents + +// Prior to Go 1.9.2, converting C.kFSEventStreamEventIdSinceNow to a uint64 +// results in the error: "constant -1 overflows uint64". +// Related Go issue: https://github.com/golang/go/issues/21708 + +// Hardcoding the value here from FSEvents.h: +// kFSEventStreamEventIdSinceNow = 0xFFFFFFFFFFFFFFFFULL + +// eventIDSinceNow is a sentinel to begin watching events "since now". +const eventIDSinceNow = uint64(0xFFFFFFFFFFFFFFFF) diff --git a/vendor/github.com/fsnotify/fsevents/wrap.go b/vendor/github.com/fsnotify/fsevents/wrap.go index 6e4e418f18d..b3ce5d95ec7 100644 --- a/vendor/github.com/fsnotify/fsevents/wrap.go +++ b/vendor/github.com/fsnotify/fsevents/wrap.go @@ -1,4 +1,4 @@ -// +build darwin,go1.10 +// +build darwin package fsevents @@ -34,9 +34,6 @@ import ( "unsafe" ) -// eventIDSinceNow is a sentinel to begin watching events "since now". -const eventIDSinceNow = uint64(C.kFSEventStreamEventIdSinceNow) - // LatestEventID returns the most recently generated event ID, system-wide. func LatestEventID() uint64 { return uint64(C.FSEventsGetCurrentEventId()) @@ -105,21 +102,11 @@ func GetStreamRefPaths(f FSEventStreamRef) []string { return ss } -// GetDeviceUUID retrieves the UUID required to identify an EventID -// in the FSEvents database -func GetDeviceUUID(deviceID int32) string { - uuid := C.FSEventsCopyUUIDForDevice(C.dev_t(deviceID)) - if uuid == C.CFUUIDRef(0) { - return "" - } - return cfStringToGoString(C.CFUUIDCreateString(nil, uuid)) -} - func cfStringToGoString(cfs C.CFStringRef) string { - if cfs == 0 { + if cfs == nullCFStringRef { return "" } - cfStr := C.CFStringCreateCopy(nil, cfs) + cfStr := copyCFString(cfs) length := C.CFStringGetLength(cfStr) if length == 0 { // short-cut for empty strings @@ -148,6 +135,11 @@ func cfStringToGoString(cfs C.CFStringRef) string { return *(*string)(unsafe.Pointer(strHeader)) } +// copyCFString makes an immutable copy of a string with CFStringCreateCopy. +func copyCFString(cfs C.CFStringRef) C.CFStringRef { + return C.CFStringCreateCopy(C.kCFAllocatorDefault, cfs) +} + // CFRunLoopRef wraps C.CFRunLoopRef type CFRunLoopRef C.CFRunLoopRef @@ -169,10 +161,7 @@ func createPaths(paths []string) (C.CFArrayRef, error) { // because of them errs = append(errs, err) } - cpath := C.CString(p) - defer C.free(unsafe.Pointer(cpath)) - - str := C.CFStringCreateWithCString(nil, cpath, C.kCFStringEncodingUTF8) + str := makeCFString(p) C.CFArrayAppendValue(C.CFMutableArrayRef(cPaths), unsafe.Pointer(str)) } var err error @@ -182,6 +171,13 @@ func createPaths(paths []string) (C.CFArrayRef, error) { return cPaths, err } +// makeCFString makes an immutable string with CFStringCreateWithCString. +func makeCFString(str string) C.CFStringRef { + s := C.CString(str) + defer C.free(unsafe.Pointer(s)) + return C.CFStringCreateWithCString(C.kCFAllocatorDefault, s, C.kCFStringEncodingUTF8) +} + // CFArrayLen retrieves the length of CFArray type // See https://developer.apple.com/library/mac/documentation/CoreFoundation/Reference/CFArrayRef/#//apple_ref/c/func/CFArrayGetCount func cfArrayLen(ref C.CFArrayRef) int { diff --git a/vendor/github.com/fsnotify/fsevents/wrap_deprecated.go b/vendor/github.com/fsnotify/fsevents/wrap_deprecated.go deleted file mode 100644 index 5493428bd71..00000000000 --- a/vendor/github.com/fsnotify/fsevents/wrap_deprecated.go +++ /dev/null @@ -1,276 +0,0 @@ -// +build darwin,!go1.10 - -package fsevents - -/* -#cgo LDFLAGS: -framework CoreServices -#include -#include - -static CFArrayRef ArrayCreateMutable(int len) { - return CFArrayCreateMutable(NULL, len, &kCFTypeArrayCallBacks); -} - -extern void fsevtCallback(FSEventStreamRef p0, uintptr_t info, size_t p1, char** p2, FSEventStreamEventFlags* p3, FSEventStreamEventId* p4); - -static FSEventStreamRef EventStreamCreateRelativeToDevice(FSEventStreamContext * context, uintptr_t info, dev_t dev, CFArrayRef paths, FSEventStreamEventId since, CFTimeInterval latency, FSEventStreamCreateFlags flags) { - context->info = (void*) info; - return FSEventStreamCreateRelativeToDevice(NULL, (FSEventStreamCallback) fsevtCallback, context, dev, paths, since, latency, flags); -} - -static FSEventStreamRef EventStreamCreate(FSEventStreamContext * context, uintptr_t info, CFArrayRef paths, FSEventStreamEventId since, CFTimeInterval latency, FSEventStreamCreateFlags flags) { - context->info = (void*) info; - return FSEventStreamCreate(NULL, (FSEventStreamCallback) fsevtCallback, context, paths, since, latency, flags); -} -*/ -import "C" -import ( - "fmt" - "log" - "path/filepath" - "reflect" - "runtime" - "time" - "unsafe" -) - -// eventIDSinceNow is a sentinel to begin watching events "since now". -// NOTE: Go 1.9.2 broke compatibility here, for 1.9.1 and earlier we did: -// uint64(C.kFSEventStreamEventIdSinceNow + (1 << 64)) -// But 1.9.2+ complains about overflow and requires: -// uint64(C.kFSEventStreamEventIdSinceNow) -// There does not seem to be an easy way to rectify, so hardcoding the value -// here from FSEvents.h: -// kFSEventStreamEventIdSinceNow = 0xFFFFFFFFFFFFFFFFULL -const eventIDSinceNow = uint64(0xFFFFFFFFFFFFFFFF) - -// LatestEventID returns the most recently generated event ID, system-wide. -func LatestEventID() uint64 { - return uint64(C.FSEventsGetCurrentEventId()) -} - -// arguments are released by C at the end of the callback. Ensure copies -// are made if data is expected to persist beyond this function ending. -// -//export fsevtCallback -func fsevtCallback(stream C.FSEventStreamRef, info uintptr, numEvents C.size_t, cpaths **C.char, cflags *C.FSEventStreamEventFlags, cids *C.FSEventStreamEventId) { - l := int(numEvents) - events := make([]Event, l) - - es := registry.Get(info) - if es == nil { - log.Printf("failed to retrieve registry %d", info) - return - } - // These slices are backed by C data. Ensure data is copied out - // if it expected to exist outside of this function. - paths := (*[1 << 30]*C.char)(unsafe.Pointer(cpaths))[:l:l] - ids := (*[1 << 30]C.FSEventStreamEventId)(unsafe.Pointer(cids))[:l:l] - flags := (*[1 << 30]C.FSEventStreamEventFlags)(unsafe.Pointer(cflags))[:l:l] - for i := range events { - events[i] = Event{ - Path: C.GoString(paths[i]), - Flags: EventFlags(flags[i]), - ID: uint64(ids[i]), - } - es.EventID = uint64(ids[i]) - } - - es.Events <- events -} - -// FSEventStreamRef wraps C.FSEventStreamRef -type FSEventStreamRef C.FSEventStreamRef - -// GetStreamRefEventID retrieves the last EventID from the ref -func GetStreamRefEventID(f FSEventStreamRef) uint64 { - return uint64(C.FSEventStreamGetLatestEventId(f)) -} - -// GetStreamRefDeviceID retrieves the device ID the stream is watching -func GetStreamRefDeviceID(f FSEventStreamRef) int32 { - return int32(C.FSEventStreamGetDeviceBeingWatched(f)) -} - -// GetStreamRefDescription retrieves debugging description information -// about the StreamRef -func GetStreamRefDescription(f FSEventStreamRef) string { - return cfStringToGoString(C.FSEventStreamCopyDescription(f)) -} - -// GetStreamRefPaths returns a copy of the paths being watched by -// this stream -func GetStreamRefPaths(f FSEventStreamRef) []string { - arr := C.FSEventStreamCopyPathsBeingWatched(f) - l := cfArrayLen(arr) - - ss := make([]string, l) - for i := range ss { - void := C.CFArrayGetValueAtIndex(arr, C.CFIndex(i)) - ss[i] = cfStringToGoString(C.CFStringRef(void)) - } - return ss -} - -// GetDeviceUUID retrieves the UUID required to identify an EventID -// in the FSEvents database -func GetDeviceUUID(deviceID int32) string { - uuid := C.FSEventsCopyUUIDForDevice(C.dev_t(deviceID)) - if uuid == nil { - return "" - } - return cfStringToGoString(C.CFUUIDCreateString(nil, uuid)) -} - -func cfStringToGoString(cfs C.CFStringRef) string { - if cfs == nil { - return "" - } - cfStr := C.CFStringCreateCopy(nil, cfs) - length := C.CFStringGetLength(cfStr) - if length == 0 { - // short-cut for empty strings - return "" - } - cfRange := C.CFRange{0, length} - enc := C.CFStringEncoding(C.kCFStringEncodingUTF8) - // first find the buffer size necessary - var usedBufLen C.CFIndex - if C.CFStringGetBytes(cfStr, cfRange, enc, 0, C.false, nil, 0, &usedBufLen) == 0 { - return "" - } - - bs := make([]byte, usedBufLen) - buf := (*C.UInt8)(unsafe.Pointer(&bs[0])) - if C.CFStringGetBytes(cfStr, cfRange, enc, 0, C.false, buf, usedBufLen, nil) == 0 { - return "" - } - - // Create a string (byte array) backed by C byte array - header := (*reflect.SliceHeader)(unsafe.Pointer(&bs)) - strHeader := &reflect.StringHeader{ - Data: header.Data, - Len: header.Len, - } - return *(*string)(unsafe.Pointer(strHeader)) -} - -// CFRunLoopRef wraps C.CFRunLoopRef -type CFRunLoopRef C.CFRunLoopRef - -// EventIDForDeviceBeforeTime returns an event ID before a given time. -func EventIDForDeviceBeforeTime(dev int32, before time.Time) uint64 { - tm := C.CFAbsoluteTime(before.Unix()) - return uint64(C.FSEventsGetLastEventIdForDeviceBeforeTime(C.dev_t(dev), tm)) -} - -// createPaths accepts the user defined set of paths and returns FSEvents -// compatible array of paths -func createPaths(paths []string) (C.CFArrayRef, error) { - cPaths := C.ArrayCreateMutable(C.int(len(paths))) - var errs []error - for _, path := range paths { - p, err := filepath.Abs(path) - if err != nil { - // hack up some reporting errors, but don't prevent execution - // because of them - errs = append(errs, err) - } - cpath := C.CString(p) - defer C.free(unsafe.Pointer(cpath)) - - str := C.CFStringCreateWithCString(nil, cpath, C.kCFStringEncodingUTF8) - C.CFArrayAppendValue(cPaths, unsafe.Pointer(str)) - } - var err error - if len(errs) > 0 { - err = fmt.Errorf("%q", errs) - } - return cPaths, err -} - -// CFArrayLen retrieves the length of CFArray type -// See https://developer.apple.com/library/mac/documentation/CoreFoundation/Reference/CFArrayRef/#//apple_ref/c/func/CFArrayGetCount -func cfArrayLen(ref C.CFArrayRef) int { - // FIXME: this will probably crash on 32bit, untested - // requires OS X v10.0 - return int(C.CFArrayGetCount(ref)) -} - -func setupStream(paths []string, flags CreateFlags, callbackInfo uintptr, eventID uint64, latency time.Duration, deviceID int32) FSEventStreamRef { - cPaths, err := createPaths(paths) - if err != nil { - log.Printf("Error creating paths: %s", err) - } - defer C.CFRelease(C.CFTypeRef(cPaths)) - - since := C.FSEventStreamEventId(eventID) - context := C.FSEventStreamContext{} - info := C.uintptr_t(callbackInfo) - cfinv := C.CFTimeInterval(float64(latency) / float64(time.Second)) - - var ref C.FSEventStreamRef - if deviceID != 0 { - ref = C.EventStreamCreateRelativeToDevice(&context, info, - C.dev_t(deviceID), cPaths, since, cfinv, - C.FSEventStreamCreateFlags(flags)) - } else { - ref = C.EventStreamCreate(&context, info, cPaths, since, - cfinv, C.FSEventStreamCreateFlags(flags)) - } - - return FSEventStreamRef(ref) -} - -func (es *EventStream) start(paths []string, callbackInfo uintptr) { - - since := eventIDSinceNow - if es.Resume { - since = es.EventID - } - - es.stream = setupStream(paths, es.Flags, callbackInfo, since, es.Latency, es.Device) - - started := make(chan struct{}) - - go func() { - runtime.LockOSThread() - es.rlref = CFRunLoopRef(C.CFRunLoopGetCurrent()) - C.FSEventStreamScheduleWithRunLoop(es.stream, es.rlref, C.kCFRunLoopDefaultMode) - C.FSEventStreamStart(es.stream) - close(started) - C.CFRunLoopRun() - }() - - if !es.hasFinalizer { - // TODO: There is no guarantee this run before program exit - // and could result in panics at exit. - runtime.SetFinalizer(es, finalizer) - es.hasFinalizer = true - } - - <-started -} - -func finalizer(es *EventStream) { - // If an EventStream is freed without Stop being called it will - // cause a panic. This avoids that, and closes the stream instead. - es.Stop() -} - -// flush drains the event stream of undelivered events -func flush(stream FSEventStreamRef, sync bool) { - if sync { - C.FSEventStreamFlushSync(stream) - } else { - C.FSEventStreamFlushAsync(stream) - } -} - -// stop requests fsevents stops streaming events -func stop(stream FSEventStreamRef, rlref CFRunLoopRef) { - C.FSEventStreamStop(stream) - C.FSEventStreamInvalidate(stream) - C.FSEventStreamRelease(stream) - C.CFRunLoopStop(rlref) -} diff --git a/vendor/github.com/magefile/mage/Gopkg.lock b/vendor/github.com/magefile/mage/Gopkg.lock deleted file mode 100644 index bef2d0092eb..00000000000 --- a/vendor/github.com/magefile/mage/Gopkg.lock +++ /dev/null @@ -1,9 +0,0 @@ -# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. - - -[solve-meta] - analyzer-name = "dep" - analyzer-version = 1 - inputs-digest = "ab4fef131ee828e96ba67d31a7d690bd5f2f42040c6766b1b12fe856f87e0ff7" - solver-name = "gps-cdcl" - solver-version = 1 diff --git a/vendor/github.com/magefile/mage/Gopkg.toml b/vendor/github.com/magefile/mage/Gopkg.toml deleted file mode 100644 index 9425a542966..00000000000 --- a/vendor/github.com/magefile/mage/Gopkg.toml +++ /dev/null @@ -1,22 +0,0 @@ - -# Gopkg.toml example -# -# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md -# for detailed Gopkg.toml documentation. -# -# required = ["github.com/user/thing/cmd/thing"] -# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] -# -# [[constraint]] -# name = "github.com/user/project" -# version = "1.0.0" -# -# [[constraint]] -# name = "github.com/user/project2" -# branch = "dev" -# source = "github.com/myfork/project2" -# -# [[override]] -# name = "github.com/x/y" -# version = "2.4.0" - diff --git a/vendor/github.com/magefile/mage/README.md b/vendor/github.com/magefile/mage/README.md index 63826bb7106..b757a92c690 100644 --- a/vendor/github.com/magefile/mage/README.md +++ b/vendor/github.com/magefile/mage/README.md @@ -1,6 +1,9 @@ +[![Built with Mage](https://magefile.org/badge.svg)](https://magefile.org) +[![Build Status](https://travis-ci.org/magefile/mage.svg?branch=master)](https://travis-ci.org/magefile/mage) [![Build status](https://ci.appveyor.com/api/projects/status/n6h146y79xgxkidl/branch/master?svg=true)](https://ci.appveyor.com/project/natefinch/mage/branch/master) +

-## About [![Build Status](https://travis-ci.org/magefile/mage.svg?branch=master)](https://travis-ci.org/magefile/mage) +## About Mage is a make/rake-like build tool using Go. You write plain-old go functions, and Mage automatically uses them as Makefile-like runnable targets. diff --git a/vendor/github.com/magefile/mage/go.mod b/vendor/github.com/magefile/mage/go.mod new file mode 100644 index 00000000000..d702af13eb7 --- /dev/null +++ b/vendor/github.com/magefile/mage/go.mod @@ -0,0 +1 @@ +module github.com/magefile/mage diff --git a/vendor/github.com/magefile/mage/go.sum b/vendor/github.com/magefile/mage/go.sum new file mode 100644 index 00000000000..e69de29bb2d diff --git a/vendor/github.com/magefile/mage/magefile.go b/vendor/github.com/magefile/mage/magefile.go index 2bb3ace6fee..12e9a48daab 100644 --- a/vendor/github.com/magefile/mage/magefile.go +++ b/vendor/github.com/magefile/mage/magefile.go @@ -1,5 +1,8 @@ //+build mage +// This is the build script for Mage. The install target is all you really need. +// The release target is for generating offial releases and is really only +// useful to project admins. package main import ( @@ -7,25 +10,24 @@ import ( "fmt" "os" "path/filepath" + "regexp" "runtime" "strings" "time" + "github.com/magefile/mage/mg" "github.com/magefile/mage/sh" ) // Runs "go install" for mage. This generates the version info the binary. func Install() error { - ldf, err := flags() - if err != nil { - return err - } - name := "mage" if runtime.GOOS == "windows" { name += ".exe" } - gopath, err := sh.Output("go", "env", "GOPATH") + + gocmd := mg.GoCmd() + gopath, err := sh.Output(gocmd, "env", "GOPATH") if err != nil { return fmt.Errorf("can't determine GOPATH: %v", err) } @@ -42,19 +44,23 @@ func Install() error { // install` turns into a no-op, and `go install -a` fails on people's // machines that have go installed in a non-writeable directory (such as // normal OS installs in /usr/bin) - return sh.RunV("go", "build", "-o", path, "-ldflags="+ldf, "github.com/magefile/mage") + return sh.RunV(gocmd, "build", "-o", path, "-ldflags="+flags(), "github.com/magefile/mage") } +var releaseTag = regexp.MustCompile(`^v1\.[0-9]+\.[0-9]+$`) + // Generates a new release. Expects the TAG environment variable to be set, // which will create a new tag with that name. func Release() (err error) { - if os.Getenv("TAG") == "" { - return errors.New("MSG and TAG environment variables are required") + tag := os.Getenv("TAG") + if !releaseTag.MatchString(tag) { + return errors.New("TAG environment variable must be in semver v1.x.x format, but was " + tag) } - if err := sh.RunV("git", "tag", "-a", "$TAG"); err != nil { + + if err := sh.RunV("git", "tag", "-a", tag, "-m", tag); err != nil { return err } - if err := sh.RunV("git", "push", "origin", "$TAG"); err != nil { + if err := sh.RunV("git", "push", "origin", tag); err != nil { return err } defer func() { @@ -71,14 +77,14 @@ func Clean() error { return sh.Rm("dist") } -func flags() (string, error) { +func flags() string { timestamp := time.Now().Format(time.RFC3339) hash := hash() tag := tag() if tag == "" { tag = "dev" } - return fmt.Sprintf(`-X "github.com/magefile/mage/mage.timestamp=%s" -X "github.com/magefile/mage/mage.commitHash=%s" -X "github.com/magefile/mage/mage.gitTag=%s"`, timestamp, hash, tag), nil + return fmt.Sprintf(`-X "github.com/magefile/mage/mage.timestamp=%s" -X "github.com/magefile/mage/mage.commitHash=%s" -X "github.com/magefile/mage/mage.gitTag=%s"`, timestamp, hash, tag) } // tag returns the git tag for the current branch or "" if none. diff --git a/vendor/golang.org/x/crypto/blake2b/blake2b.go b/vendor/golang.org/x/crypto/blake2b/blake2b.go index 6dedb89467a..58ea8753618 100644 --- a/vendor/golang.org/x/crypto/blake2b/blake2b.go +++ b/vendor/golang.org/x/crypto/blake2b/blake2b.go @@ -92,6 +92,8 @@ func New256(key []byte) (hash.Hash, error) { return newDigest(Size256, key) } // values equal or greater than: // - 32 if BLAKE2b is used as a hash function (The key is zero bytes long). // - 16 if BLAKE2b is used as a MAC function (The key is at least 16 bytes long). +// When the key is nil, the returned hash.Hash implements BinaryMarshaler +// and BinaryUnmarshaler for state (de)serialization as documented by hash.Hash. func New(size int, key []byte) (hash.Hash, error) { return newDigest(size, key) } func newDigest(hashSize int, key []byte) (*digest, error) { @@ -150,6 +152,50 @@ type digest struct { keyLen int } +const ( + magic = "b2b" + marshaledSize = len(magic) + 8*8 + 2*8 + 1 + BlockSize + 1 +) + +func (d *digest) MarshalBinary() ([]byte, error) { + if d.keyLen != 0 { + return nil, errors.New("crypto/blake2b: cannot marshal MACs") + } + b := make([]byte, 0, marshaledSize) + b = append(b, magic...) + for i := 0; i < 8; i++ { + b = appendUint64(b, d.h[i]) + } + b = appendUint64(b, d.c[0]) + b = appendUint64(b, d.c[1]) + // Maximum value for size is 64 + b = append(b, byte(d.size)) + b = append(b, d.block[:]...) + b = append(b, byte(d.offset)) + return b, nil +} + +func (d *digest) UnmarshalBinary(b []byte) error { + if len(b) < len(magic) || string(b[:len(magic)]) != magic { + return errors.New("crypto/blake2b: invalid hash state identifier") + } + if len(b) != marshaledSize { + return errors.New("crypto/blake2b: invalid hash state size") + } + b = b[len(magic):] + for i := 0; i < 8; i++ { + b, d.h[i] = consumeUint64(b) + } + b, d.c[0] = consumeUint64(b) + b, d.c[1] = consumeUint64(b) + d.size = int(b[0]) + b = b[1:] + copy(d.block[:], b[:BlockSize]) + b = b[BlockSize:] + d.offset = int(b[0]) + return nil +} + func (d *digest) BlockSize() int { return BlockSize } func (d *digest) Size() int { return d.size } @@ -219,3 +265,25 @@ func (d *digest) finalize(hash *[Size]byte) { binary.LittleEndian.PutUint64(hash[8*i:], v) } } + +func appendUint64(b []byte, x uint64) []byte { + var a [8]byte + binary.BigEndian.PutUint64(a[:], x) + return append(b, a[:]...) +} + +func appendUint32(b []byte, x uint32) []byte { + var a [4]byte + binary.BigEndian.PutUint32(a[:], x) + return append(b, a[:]...) +} + +func consumeUint64(b []byte) ([]byte, uint64) { + x := binary.BigEndian.Uint64(b) + return b[8:], x +} + +func consumeUint32(b []byte) ([]byte, uint32) { + x := binary.BigEndian.Uint32(b) + return b[4:], x +} diff --git a/vendor/golang.org/x/crypto/blake2b/blake2bAVX2_amd64.go b/vendor/golang.org/x/crypto/blake2b/blake2bAVX2_amd64.go index 8c41cf6c79e..4d31dd0fdcd 100644 --- a/vendor/golang.org/x/crypto/blake2b/blake2bAVX2_amd64.go +++ b/vendor/golang.org/x/crypto/blake2b/blake2bAVX2_amd64.go @@ -6,21 +6,14 @@ package blake2b +import "golang.org/x/sys/cpu" + func init() { - useAVX2 = supportsAVX2() - useAVX = supportsAVX() - useSSE4 = supportsSSE4() + useAVX2 = cpu.X86.HasAVX2 + useAVX = cpu.X86.HasAVX + useSSE4 = cpu.X86.HasSSE41 } -//go:noescape -func supportsSSE4() bool - -//go:noescape -func supportsAVX() bool - -//go:noescape -func supportsAVX2() bool - //go:noescape func hashBlocksAVX2(h *[8]uint64, c *[2]uint64, flag uint64, blocks []byte) @@ -31,13 +24,14 @@ func hashBlocksAVX(h *[8]uint64, c *[2]uint64, flag uint64, blocks []byte) func hashBlocksSSE4(h *[8]uint64, c *[2]uint64, flag uint64, blocks []byte) func hashBlocks(h *[8]uint64, c *[2]uint64, flag uint64, blocks []byte) { - if useAVX2 { + switch { + case useAVX2: hashBlocksAVX2(h, c, flag, blocks) - } else if useAVX { + case useAVX: hashBlocksAVX(h, c, flag, blocks) - } else if useSSE4 { + case useSSE4: hashBlocksSSE4(h, c, flag, blocks) - } else { + default: hashBlocksGeneric(h, c, flag, blocks) } } diff --git a/vendor/golang.org/x/crypto/blake2b/blake2bAVX2_amd64.s b/vendor/golang.org/x/crypto/blake2b/blake2bAVX2_amd64.s index 784bce6a9c4..5593b1b3dce 100644 --- a/vendor/golang.org/x/crypto/blake2b/blake2bAVX2_amd64.s +++ b/vendor/golang.org/x/crypto/blake2b/blake2bAVX2_amd64.s @@ -748,15 +748,3 @@ noinc: MOVQ BP, SP RET - -// func supportsAVX2() bool -TEXT ·supportsAVX2(SB), 4, $0-1 - MOVQ runtime·support_avx2(SB), AX - MOVB AX, ret+0(FP) - RET - -// func supportsAVX() bool -TEXT ·supportsAVX(SB), 4, $0-1 - MOVQ runtime·support_avx(SB), AX - MOVB AX, ret+0(FP) - RET diff --git a/vendor/golang.org/x/crypto/blake2b/blake2b_amd64.go b/vendor/golang.org/x/crypto/blake2b/blake2b_amd64.go index 2ab7c30fc2b..30e2fcd581f 100644 --- a/vendor/golang.org/x/crypto/blake2b/blake2b_amd64.go +++ b/vendor/golang.org/x/crypto/blake2b/blake2b_amd64.go @@ -6,13 +6,12 @@ package blake2b +import "golang.org/x/sys/cpu" + func init() { - useSSE4 = supportsSSE4() + useSSE4 = cpu.X86.HasSSE41 } -//go:noescape -func supportsSSE4() bool - //go:noescape func hashBlocksSSE4(h *[8]uint64, c *[2]uint64, flag uint64, blocks []byte) diff --git a/vendor/golang.org/x/crypto/blake2b/blake2b_amd64.s b/vendor/golang.org/x/crypto/blake2b/blake2b_amd64.s index 64530740b40..578e947b3bf 100644 --- a/vendor/golang.org/x/crypto/blake2b/blake2b_amd64.s +++ b/vendor/golang.org/x/crypto/blake2b/blake2b_amd64.s @@ -279,12 +279,3 @@ noinc: MOVQ BP, SP RET - -// func supportsSSE4() bool -TEXT ·supportsSSE4(SB), 4, $0-1 - MOVL $1, AX - CPUID - SHRL $19, CX // Bit 19 indicates SSE4 support - ANDL $1, CX // CX != 0 if support SSE4 - MOVB CX, ret+0(FP) - RET diff --git a/vendor/golang.org/x/sys/cpu/cpu.go b/vendor/golang.org/x/sys/cpu/cpu.go new file mode 100644 index 00000000000..3d88f866739 --- /dev/null +++ b/vendor/golang.org/x/sys/cpu/cpu.go @@ -0,0 +1,38 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package cpu implements processor feature detection for +// various CPU architectures. +package cpu + +// CacheLinePad is used to pad structs to avoid false sharing. +type CacheLinePad struct{ _ [cacheLineSize]byte } + +// X86 contains the supported CPU features of the +// current X86/AMD64 platform. If the current platform +// is not X86/AMD64 then all feature flags are false. +// +// X86 is padded to avoid false sharing. Further the HasAVX +// and HasAVX2 are only set if the OS supports XMM and YMM +// registers in addition to the CPUID feature bit being set. +var X86 struct { + _ CacheLinePad + HasAES bool // AES hardware implementation (AES NI) + HasADX bool // Multi-precision add-carry instruction extensions + HasAVX bool // Advanced vector extension + HasAVX2 bool // Advanced vector extension 2 + HasBMI1 bool // Bit manipulation instruction set 1 + HasBMI2 bool // Bit manipulation instruction set 2 + HasERMS bool // Enhanced REP for MOVSB and STOSB + HasFMA bool // Fused-multiply-add instructions + HasOSXSAVE bool // OS supports XSAVE/XRESTOR for saving/restoring XMM registers. + HasPCLMULQDQ bool // PCLMULQDQ instruction - most often used for AES-GCM + HasPOPCNT bool // Hamming weight instruction POPCNT. + HasSSE2 bool // Streaming SIMD extension 2 (always available on amd64) + HasSSE3 bool // Streaming SIMD extension 3 + HasSSSE3 bool // Supplemental streaming SIMD extension 3 + HasSSE41 bool // Streaming SIMD extension 4 and 4.1 + HasSSE42 bool // Streaming SIMD extension 4 and 4.2 + _ CacheLinePad +} diff --git a/vendor/golang.org/x/sys/cpu/cpu_arm.go b/vendor/golang.org/x/sys/cpu/cpu_arm.go new file mode 100644 index 00000000000..d93036f7522 --- /dev/null +++ b/vendor/golang.org/x/sys/cpu/cpu_arm.go @@ -0,0 +1,7 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package cpu + +const cacheLineSize = 32 diff --git a/vendor/golang.org/x/sys/cpu/cpu_arm64.go b/vendor/golang.org/x/sys/cpu/cpu_arm64.go new file mode 100644 index 00000000000..1d2ab2902a7 --- /dev/null +++ b/vendor/golang.org/x/sys/cpu/cpu_arm64.go @@ -0,0 +1,7 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package cpu + +const cacheLineSize = 64 diff --git a/vendor/golang.org/x/sys/cpu/cpu_gc_x86.go b/vendor/golang.org/x/sys/cpu/cpu_gc_x86.go new file mode 100644 index 00000000000..f7cb46971cb --- /dev/null +++ b/vendor/golang.org/x/sys/cpu/cpu_gc_x86.go @@ -0,0 +1,16 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build 386 amd64 amd64p32 +// +build !gccgo + +package cpu + +// cpuid is implemented in cpu_x86.s for gc compiler +// and in cpu_gccgo.c for gccgo. +func cpuid(eaxArg, ecxArg uint32) (eax, ebx, ecx, edx uint32) + +// xgetbv with ecx = 0 is implemented in cpu_x86.s for gc compiler +// and in cpu_gccgo.c for gccgo. +func xgetbv() (eax, edx uint32) diff --git a/vendor/golang.org/x/sys/cpu/cpu_gccgo.c b/vendor/golang.org/x/sys/cpu/cpu_gccgo.c new file mode 100644 index 00000000000..e363c7d1319 --- /dev/null +++ b/vendor/golang.org/x/sys/cpu/cpu_gccgo.c @@ -0,0 +1,43 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build 386 amd64 amd64p32 +// +build gccgo + +#include +#include + +// Need to wrap __get_cpuid_count because it's declared as static. +int +gccgoGetCpuidCount(uint32_t leaf, uint32_t subleaf, + uint32_t *eax, uint32_t *ebx, + uint32_t *ecx, uint32_t *edx) +{ + return __get_cpuid_count(leaf, subleaf, eax, ebx, ecx, edx); +} + +// xgetbv reads the contents of an XCR (Extended Control Register) +// specified in the ECX register into registers EDX:EAX. +// Currently, the only supported value for XCR is 0. +// +// TODO: Replace with a better alternative: +// +// #include +// +// #pragma GCC target("xsave") +// +// void gccgoXgetbv(uint32_t *eax, uint32_t *edx) { +// unsigned long long x = _xgetbv(0); +// *eax = x & 0xffffffff; +// *edx = (x >> 32) & 0xffffffff; +// } +// +// Note that _xgetbv is defined starting with GCC 8. +void +gccgoXgetbv(uint32_t *eax, uint32_t *edx) +{ + __asm(" xorl %%ecx, %%ecx\n" + " xgetbv" + : "=a"(*eax), "=d"(*edx)); +} diff --git a/vendor/golang.org/x/sys/cpu/cpu_gccgo.go b/vendor/golang.org/x/sys/cpu/cpu_gccgo.go new file mode 100644 index 00000000000..ba49b91bd39 --- /dev/null +++ b/vendor/golang.org/x/sys/cpu/cpu_gccgo.go @@ -0,0 +1,26 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build 386 amd64 amd64p32 +// +build gccgo + +package cpu + +//extern gccgoGetCpuidCount +func gccgoGetCpuidCount(eaxArg, ecxArg uint32, eax, ebx, ecx, edx *uint32) + +func cpuid(eaxArg, ecxArg uint32) (eax, ebx, ecx, edx uint32) { + var a, b, c, d uint32 + gccgoGetCpuidCount(eaxArg, ecxArg, &a, &b, &c, &d) + return a, b, c, d +} + +//extern gccgoXgetbv +func gccgoXgetbv(eax, edx *uint32) + +func xgetbv() (eax, edx uint32) { + var a, d uint32 + gccgoXgetbv(&a, &d) + return a, d +} diff --git a/vendor/golang.org/x/sys/cpu/cpu_mips64x.go b/vendor/golang.org/x/sys/cpu/cpu_mips64x.go new file mode 100644 index 00000000000..6165f121249 --- /dev/null +++ b/vendor/golang.org/x/sys/cpu/cpu_mips64x.go @@ -0,0 +1,9 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build mips64 mips64le + +package cpu + +const cacheLineSize = 32 diff --git a/vendor/golang.org/x/sys/cpu/cpu_mipsx.go b/vendor/golang.org/x/sys/cpu/cpu_mipsx.go new file mode 100644 index 00000000000..1269eee88d0 --- /dev/null +++ b/vendor/golang.org/x/sys/cpu/cpu_mipsx.go @@ -0,0 +1,9 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build mips mipsle + +package cpu + +const cacheLineSize = 32 diff --git a/vendor/golang.org/x/sys/cpu/cpu_ppc64x.go b/vendor/golang.org/x/sys/cpu/cpu_ppc64x.go new file mode 100644 index 00000000000..d10759a524f --- /dev/null +++ b/vendor/golang.org/x/sys/cpu/cpu_ppc64x.go @@ -0,0 +1,9 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build ppc64 ppc64le + +package cpu + +const cacheLineSize = 128 diff --git a/vendor/golang.org/x/sys/cpu/cpu_s390x.go b/vendor/golang.org/x/sys/cpu/cpu_s390x.go new file mode 100644 index 00000000000..684c4f005d0 --- /dev/null +++ b/vendor/golang.org/x/sys/cpu/cpu_s390x.go @@ -0,0 +1,7 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package cpu + +const cacheLineSize = 256 diff --git a/vendor/golang.org/x/sys/cpu/cpu_x86.go b/vendor/golang.org/x/sys/cpu/cpu_x86.go new file mode 100644 index 00000000000..71e288b0622 --- /dev/null +++ b/vendor/golang.org/x/sys/cpu/cpu_x86.go @@ -0,0 +1,55 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build 386 amd64 amd64p32 + +package cpu + +const cacheLineSize = 64 + +func init() { + maxID, _, _, _ := cpuid(0, 0) + + if maxID < 1 { + return + } + + _, _, ecx1, edx1 := cpuid(1, 0) + X86.HasSSE2 = isSet(26, edx1) + + X86.HasSSE3 = isSet(0, ecx1) + X86.HasPCLMULQDQ = isSet(1, ecx1) + X86.HasSSSE3 = isSet(9, ecx1) + X86.HasFMA = isSet(12, ecx1) + X86.HasSSE41 = isSet(19, ecx1) + X86.HasSSE42 = isSet(20, ecx1) + X86.HasPOPCNT = isSet(23, ecx1) + X86.HasAES = isSet(25, ecx1) + X86.HasOSXSAVE = isSet(27, ecx1) + + osSupportsAVX := false + // For XGETBV, OSXSAVE bit is required and sufficient. + if X86.HasOSXSAVE { + eax, _ := xgetbv() + // Check if XMM and YMM registers have OS support. + osSupportsAVX = isSet(1, eax) && isSet(2, eax) + } + + X86.HasAVX = isSet(28, ecx1) && osSupportsAVX + + if maxID < 7 { + return + } + + _, ebx7, _, _ := cpuid(7, 0) + X86.HasBMI1 = isSet(3, ebx7) + X86.HasAVX2 = isSet(5, ebx7) && osSupportsAVX + X86.HasBMI2 = isSet(8, ebx7) + X86.HasERMS = isSet(9, ebx7) + X86.HasADX = isSet(19, ebx7) +} + +func isSet(bitpos uint, value uint32) bool { + return value&(1< RUN set -x && \ diff --git a/x-pack/functionbeat/provider/aws/cli_manager.go b/x-pack/functionbeat/provider/aws/cli_manager.go index c70b73b2686..ef5f6f12fb9 100644 --- a/x-pack/functionbeat/provider/aws/cli_manager.go +++ b/x-pack/functionbeat/provider/aws/cli_manager.go @@ -153,7 +153,7 @@ func (c *CLIManager) template(function installer, name, templateLoc string) *clo Handler: handlerName, MemorySize: lambdaConfig.MemorySize.Megabytes(), ReservedConcurrentExecutions: lambdaConfig.Concurrency, - Timeout: int(lambdaConfig.Timeout.Seconds()), + Timeout: int(lambdaConfig.Timeout.Seconds()), }, DependsOn: []string{"IAMRoleLambdaExecution"}, }