github.com/datadog/orchestrion/_tools v0.0.0-20260706084330-df04ed94b69e
Legitimate Go tooling source code
Shell changes working directoryimports encoding/csv
SHA-256bb3463f7ece3ecbcb7b1f3bc0816d644f3b44ab14c0628db1d59728df2eea3c2
MaleculeH₂(F₂Po₂)
Evidence
1#!/usr/bin/env bash
2set -euo pipefail
3
4TMPDIR=$(mktemp -d "${TMPDIR}/make-licenses.XXXXXX")
5trap "rm -rf ${TMPDIR}" EXIT ERR TERM
6
7SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
8
9go -C $(dirname "${BASH_SOURCE[0]}") build -o "${TMPDIR}/bin/go-licenses" github.com/google/go-licenses/v2
10
11# This package somehow breaks the license detection...
12IGNORE_LIST="github.com/DataDog/sketches-go/ddsketch"
13
14# We run for linux, darwin and windows to get all the licenses, including platform-conditional ones.
15SOURCES="${TMPDIR}/sources"
16mkdir -p "${SOURCES}"
17declare -a LICENSE_FILES
18for GOOS in linux darwin windows; do
19 SOURCE_DIR="${TMPDIR}/sources-${GOOS}"
20 echo "Aggregating source files in $(basename "${SOURCE_DIR}") so we can scrape copyright stat …
21:114… "${TMPDIR}/errors" || (cat "${TMPDIR}/errors" >&2 && exit -1)
22 chmod -R a+rw "${SOURCE_DIR}"
23 cp -r "${SOURCE_DIR}"/* "${SOURCES}/"
24
25 OUTFILE="${TMPDIR}/LICENSE-3rdparty.${GOOS}.csv"
26 echo "Building $(basename "${OUTFILE}")"
27 GOOS="${GOOS}" "${TMPDIR}/bin/go-licenses" report …
4:11… ht 2023-present Datadog, Inc.
5
6package main
7
8import (
9 "bufio"
10 "encoding/csv"
11 "flag"
12 "fmt"
13 "log"
14 "os"
15 "path/filepath"
16 "regexp"
17 "sort"
18 "strings"
19)
20
21func main() {
22 var (
23 licensesDir string
24 outputFile string
25 )
26 flag.StringVar(&licensesDir, "licenses", "/tmp/licenses", "directory containing all pages license information")
27 flag.StringVar(&outputFile, "output", "LICENSE-3rdparty.csv", "output file to write")
28 flag.Parse()
29
30 licensesDir = filepat …
44 log.Printf("Writing data to %s\n", outputFile)
45 if err := store.WriteFile(outputFile); err != nil {
46 log.Fatalf("Error writing %q: %v\n", outputFile, err)
47 }
⋯5 lines
134:26… range compData {
135 license.copyright = scanPkg(filepath.Join(pkgDir, origin))
136 }
137 }
138}
139
140func (l *Licenses) WriteFile(filename string) error {
141 f, err := os.Create(filename)
142 if err != nil {
143 return err
⋯4 lines
148 defer w.Flush()
149
150 if err := w.Write([]string{"Component", "Origin", "License", "Copyright"}); err != nil {
151 return err
152 }
153
154 var records [][4]string
155 for component …
No evidence locations were recorded for this file. Raw result