diff options
| author | Xe Iaso <me@xeiaso.net> | 2024-05-14 19:56:25 -0500 |
|---|---|---|
| committer | Xe Iaso <me@xeiaso.net> | 2024-05-14 19:56:28 -0500 |
| commit | 687cb6451b528041e4586d84d8dec4d0e036a1f6 (patch) | |
| tree | 363c8a786457968e6bb2fcbbdca9cd31d1b71111 /cmd | |
| parent | cc378f9be316495e61a1385a03c267dad7ad5a5f (diff) | |
| download | xesite-687cb6451b528041e4586d84d8dec4d0e036a1f6.tar.xz xesite-687cb6451b528041e4586d84d8dec4d0e036a1f6.zip | |
cmd/no-way-to-prevent-this: C++
Also golf the code a bit so that it fits into _exactly_ 69 lines of Go.
Fitting into 69 lines of Go is critical for this program.
Signed-off-by: Xe Iaso <me@xeiaso.net>
Diffstat (limited to 'cmd')
| -rw-r--r-- | cmd/no-way-to-prevent-this/main.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/cmd/no-way-to-prevent-this/main.go b/cmd/no-way-to-prevent-this/main.go index 5ce135b..4cf85d1 100644 --- a/cmd/no-way-to-prevent-this/main.go +++ b/cmd/no-way-to-prevent-this/main.go @@ -11,6 +11,7 @@ import ( var ( date = flag.String("date", time.Now().Format(time.DateOnly), "Date of the CVE") + cPlusPlus = flag.Bool("c++", false, "If true, the project is written in C++") cve = flag.String("cve", "", "CVE number") cveLink = flag.String("cve-link", "", "CVE link") project = flag.String("project", "", "Project name") @@ -28,16 +29,15 @@ func main() { } defer fout.Close() - name := faker.Name() - - data := map[string]string{ + data := map[string]any{ "Date": *date, "CVE": *cve, "CVELink": *cveLink, "Project": *project, "ProjectLink": *projectLink, "Summary": *summary, - "Name": name, + "Name": faker.Name(), + "CPlusPlus": *cPlusPlus, } tmpl := template.Must(template.New("article").Parse(articleTemplate)) @@ -59,7 +59,7 @@ hero: In the hours following the release of [{{.CVE}}]({{.CVELink}}) for the project [{{.Project}}]({{.ProjectLink}}), site reliability workers and systems administrators scrambled to desperately rebuild and patch all their systems to fix {{.Summary}}. This is due to the affected components being -written in C, the only programming language where these vulnerabilities regularly happen. "This was a terrible tragedy, but sometimes +written in C{{if .CPlusPlus}}++{{end}}, the only programming language where these vulnerabilities regularly happen. "This was a terrible tragedy, but sometimes these things just happen and there's nothing anyone can do to stop them," said programmer {{.Name}}, echoing statements expressed by hundreds of thousands of programmers who use the only language where 90% of the world's memory safety vulnerabilities have occurred in the last 50 years, and whose projects are 20 times more likely to have security vulnerabilities. "It's a shame, but what can |
