-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[x/tour] tour: map old urls to new ones where possible
Fixes golang/go#11103 Change-Id: Ib24ff2d7ae6ce46e1011c29234c02a76319bc743 Reviewed-on: https://go-review.googlesource.com/12775 Reviewed-by: Andrew Gerrand <adg@golang.org> X-Tour-Commit: e7ac802432933530d235aa97b2c4fdef7a1e64fb
- Loading branch information
1 parent
0e552b7
commit 01ab8f4
Showing
4 changed files
with
213 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/bin/sh | ||
|
||
# Copyright 2011 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. | ||
|
||
# This code parses mapping.old and finds a correspondance from the old | ||
# urls (e.g. #42) to the corresponding path (e.g. /concurrency/3). | ||
|
||
function findURL { | ||
title="$1" | ||
file=$(grep -l "* $title\$" *.article) | ||
if [[ -z $file ]] | ||
then | ||
echo "undefined" | ||
return 1 | ||
fi | ||
titles=$(grep "^* " $file | awk '{print NR, $0}') | ||
page=$(echo "$titles" | grep "* $title\$" | awk '{print $1}') | ||
if [[ $(echo "$page" | wc -l) -gt "1" ]] | ||
then | ||
echo "multiple matches found for $title; find 'CHOOSE BETWEEN' in the output" 1>&2 | ||
page="CHOOSE BETWEEN $page" | ||
fi | ||
|
||
page=$(echo $page) | ||
lesson=$(echo "$file" | rev | cut -c 9- | rev) | ||
echo "'/$lesson/$page'" | ||
return 0 | ||
} | ||
|
||
mapping=`cat mapping.old` | ||
|
||
pushd ../content | ||
echo "$mapping" | while read page; do | ||
num=$(echo "$page" | awk '{print $1}') | ||
title=$(echo "$page" | sed "s/[0-9]* //") | ||
url=$(findURL "$title") | ||
echo " '#$num': $url, // $title" | ||
done | ||
popd > /dev/null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
1 Hello, 世界 | ||
2 Go local | ||
3 Packages | ||
4 Imports | ||
5 Exported names | ||
6 Functions | ||
7 Functions continued | ||
8 Multiple results | ||
9 Named results | ||
10 Variables | ||
11 Variables with initializers | ||
12 Short variable declarations | ||
13 Basic types | ||
14 Type conversions | ||
15 Constants | ||
16 Numeric Constants | ||
17 For | ||
18 For continued | ||
19 For is Go's "while" | ||
20 Forever | ||
21 If | ||
22 If with a short statement | ||
23 If and else | ||
24 Exercise: Loops and Functions | ||
25 Structs | ||
26 Struct Fields | ||
27 Pointers | ||
28 Struct Literals | ||
29 The new function | ||
30 Arrays | ||
31 Slices | ||
32 Slicing slices | ||
33 Making slices | ||
34 Nil slices | ||
35 Range | ||
36 Range continued | ||
37 Exercise: Slices | ||
38 Maps | ||
39 Map literals | ||
40 Map literals continued | ||
41 Mutating Maps | ||
42 Exercise: Maps | ||
43 Function values | ||
44 Function closures | ||
45 Exercise: Fibonacci closure | ||
46 Switch | ||
47 Switch evaluation order | ||
48 Switch with no condition | ||
49 Advanced Exercise: Complex cube roots | ||
50 Methods and Interfaces | ||
51 Methods | ||
52 Methods continued | ||
53 Methods with pointer receivers | ||
54 Interfaces | ||
55 Interfaces are satisfied implicitly | ||
56 Errors | ||
57 Exercise: Errors | ||
58 Web servers | ||
59 Exercise: HTTP Handlers | ||
60 Images | ||
61 Exercise: Images | ||
62 Exercise: Rot13 Reader | ||
63 Concurrency | ||
64 Goroutines | ||
65 Channels | ||
66 Buffered Channels | ||
67 Range and Close | ||
68 Select | ||
69 Default Selection | ||
70 Exercise: Equivalent Binary Trees | ||
71 Exercise: Equivalent Binary Trees | ||
72 Exercise: Web Crawler | ||
73 Where to Go from here... |