internal/pkgdoc: remove support for Go 1.18
Simplify code now that Go 1.18 is no longer supported.
Change-Id: I97b522e04bcb5884c19ccbcf98bbd12b2709329b
Reviewed-on: https://go-review.googlesource.com/c/website/+/457035
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
diff --git a/internal/pkgdoc/funcs.go b/internal/pkgdoc/funcs.go
index 4ba74f7..6697228 100644
--- a/internal/pkgdoc/funcs.go
+++ b/internal/pkgdoc/funcs.go
@@ -155,10 +155,7 @@
// Comment formats the given documentation comment as HTML.
func (p *Page) Comment(comment string) template.HTML {
- // TODO: After Go 1.20 is out, this can be simplified to:
- //return template.HTML(p.PDoc.HTML(comment))
- // While deleting the go118.go and go119.go files.
- return template.HTML(docPackageHTML(p.PDoc, comment))
+ return template.HTML(p.PDoc.HTML(comment))
}
// sanitize sanitizes the argument src by replacing newlines with
diff --git a/internal/pkgdoc/go118.go b/internal/pkgdoc/go118.go
deleted file mode 100644
index 94640ef..0000000
--- a/internal/pkgdoc/go118.go
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright 2022 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.
-
-//go:build !go1.19
-// +build !go1.19
-
-package pkgdoc
-
-import (
- "bytes"
- "go/doc"
-)
-
-func docPackageHTML(_ *doc.Package, text string) []byte {
- var buf bytes.Buffer
- doc.ToHTML(&buf, text, nil)
- return buf.Bytes()
-}
diff --git a/internal/pkgdoc/go119.go b/internal/pkgdoc/go119.go
deleted file mode 100644
index dd604f4..0000000
--- a/internal/pkgdoc/go119.go
+++ /dev/null
@@ -1,12 +0,0 @@
-// Copyright 2022 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.
-
-//go:build go1.19
-// +build go1.19
-
-package pkgdoc
-
-import "go/doc"
-
-var docPackageHTML = (*doc.Package).HTML