Debian Codegraph @

internal/website/makeimports.sh

raw
1 #!/usr/bin/env bash
2 # Copyright 2018 The Go Cloud Development Kit Authors
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 # https://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15
16 # This script generates Markdown files that will include <meta> suitable for
17 # "go get"'s import path redirection feature (see
18 # https://golang.org/cmd/go/#hdr-Remote_import_paths) in the final Hugo output.
19
20
21 # https://coderwall.com/p/fkfaqq/safer-bash-scripts-with-set-euxo-pipefail
22 # except x is too verbose
23 set -euo pipefail
24
25 # Change into repository root.
26 cd "$(dirname "$0")/../.."
27 OUTDIR=internal/website/content
28
29 for pkg in $(internal/website/listnewpkgs.sh); do
30 # Only consider directories that contain Go source files.
31 outfile="$OUTDIR/$pkg/_index.md"
32 mkdir -p "$OUTDIR/$pkg"
33 echo "Generating gocloud.dev/$pkg"
34 echo "---" >> "$outfile"
35 echo "title: gocloud.dev/$pkg" >> "$outfile"
36 echo "type: pkg" >> "$outfile"
37 echo "---" >> "$outfile"
38 done
39