2021-02-12 22:32:52 +03:00
|
|
|
// Copyright 2013 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 website exports the static content as an embed.FS.
|
|
|
|
package website
|
|
|
|
|
|
|
|
import (
|
2021-08-20 17:18:33 +03:00
|
|
|
"embed"
|
2021-08-20 17:31:05 +03:00
|
|
|
"io/fs"
|
2021-02-12 22:32:52 +03:00
|
|
|
)
|
|
|
|
|
2021-11-18 18:55:19 +03:00
|
|
|
// Content returns the go.dev website's static content.
|
|
|
|
func Content() fs.FS {
|
|
|
|
return subdir(embedded, "_content")
|
|
|
|
}
|
|
|
|
|
|
|
|
// TourOnly returns the content needed only for the standalone tour.
|
|
|
|
func TourOnly() fs.FS {
|
|
|
|
return subdir(tourOnly, "_content")
|
|
|
|
}
|
2021-05-26 18:49:34 +03:00
|
|
|
|
2021-11-18 06:51:08 +03:00
|
|
|
//go:embed _content
|
2021-08-20 17:18:33 +03:00
|
|
|
var embedded embed.FS
|
2021-02-12 22:32:52 +03:00
|
|
|
|
2021-11-23 05:57:27 +03:00
|
|
|
//go:embed _content/favicon.ico
|
|
|
|
//go:embed _content/images/go-logo-white.svg
|
|
|
|
//go:embed _content/js/playground.js
|
|
|
|
//go:embed _content/tour
|
2021-11-18 18:55:19 +03:00
|
|
|
var tourOnly embed.FS
|
|
|
|
|
2021-02-12 22:32:52 +03:00
|
|
|
func subdir(fsys fs.FS, path string) fs.FS {
|
|
|
|
s, err := fs.Sub(fsys, path)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
return s
|
|
|
|
}
|