From 0eab249e1d0ad2c589008fec3cb51dd7bc627d82 Mon Sep 17 00:00:00 2001 From: Bertie690 Date: Fri, 26 Dec 2025 16:41:01 -0500 Subject: [PATCH 1/3] tour: fix offline mode `go.mod` lacking version --- _content/tour/static/js/services.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/_content/tour/static/js/services.js b/_content/tour/static/js/services.js index 42971af50a..551f7e09c3 100755 --- a/_content/tour/static/js/services.js +++ b/_content/tour/static/js/services.js @@ -60,8 +60,9 @@ factory('run', ['$window', 'editor', if (!hasGoMod) { code += '\n' + '-- go.mod --\n' + - 'module example\n' + - 'require golang.org/x/tour v0.0.0-20201207214521-004403599411\n' + + 'module example\n\n' + + 'go 1.25\n\n' + + 'require golang.org/x/tour v0.1.0\n' + '-- go.sum --\n' + 'golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=\n' + 'golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=\n' + From c20b2d36e553c8ba341038ce779af079c030c50a Mon Sep 17 00:00:00 2001 From: Bertie690 Date: Fri, 26 Dec 2025 17:15:08 -0500 Subject: [PATCH 2/3] revert accidental change to package version --- _content/tour/static/js/services.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_content/tour/static/js/services.js b/_content/tour/static/js/services.js index 551f7e09c3..28d14c592b 100755 --- a/_content/tour/static/js/services.js +++ b/_content/tour/static/js/services.js @@ -62,7 +62,7 @@ factory('run', ['$window', 'editor', '-- go.mod --\n' + 'module example\n\n' + 'go 1.25\n\n' + - 'require golang.org/x/tour v0.1.0\n' + + 'require golang.org/x/tour v0.0.0-20201207214521-004403599411\n' + '-- go.sum --\n' + 'golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=\n' + 'golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=\n' + From 4c9dc38f2fe502c837af951feb6339f5797bfeea Mon Sep 17 00:00:00 2001 From: Bertie690 Date: Sat, 10 Jan 2026 15:30:21 -0500 Subject: [PATCH 3/3] Bump x/tour version to 0.1.0, move newlines to front of lines for clarity rationale for latter is each line of code is 1:1 with lines in the generated go.mod --- _content/tour/static/js/services.js | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/_content/tour/static/js/services.js b/_content/tour/static/js/services.js index 28d14c592b..dec0933950 100755 --- a/_content/tour/static/js/services.js +++ b/_content/tour/static/js/services.js @@ -56,21 +56,22 @@ factory('run', ['$window', 'editor', // The exercises use golang.org/x/tour/{pic,reader,tree,wc} // packages, so include the golang.org/x/tour module in the // build list. - const hasGoMod = code.indexOf('\n-- go.mod --\n') !== -1 || code.startsWith('-- go.mod --\n'); + const hasGoMod = code.includes('\n-- go.mod --\n') || code.startsWith('-- go.mod --\n'); if (!hasGoMod) { - code += '\n' + - '-- go.mod --\n' + - 'module example\n\n' + - 'go 1.25\n\n' + - 'require golang.org/x/tour v0.0.0-20201207214521-004403599411\n' + - '-- go.sum --\n' + - 'golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=\n' + - 'golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=\n' + - 'golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=\n' + - 'golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=\n' + - 'golang.org/x/tools v0.0.0-20190312164927-7b79afddac43/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=\n' + - 'golang.org/x/tour v0.0.0-20201207214521-004403599411 h1:dJ4kVwSGlrLZXW6eo2IOer4Pm3wl2GIG4fytRziMgL8=\n' + - 'golang.org/x/tour v0.0.0-20201207214521-004403599411/go.mod h1:qMugOFWX59KzC8Nx7f2uvXxKxAqJfi1J6ZUHAWKnrRA=\n'; + code += '\n-- go.mod --' + + '\nmodule example' + + '\n' + + '\ngo 1.25' + + '\n' + + '\nrequire golang.org/x/tour v0.1.0' + + '\n--go.sum --' + + '\ngolang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=' + + '\ngolang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=' + + '\ngolang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=' + + '\ngolang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=' + + '\ngolang.org/x/tools v0.0.0-20190312164927-7b79afddac43/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=' + + '\ngolang.org/x/tour v0.1.0 h1:OWzbINRoGf1wwBhKdFDpYwM88NM0d1SL/Nj6PagS6YE=' + + '\ngolang.org/x/tour v0.1.0/go.mod h1:DUZC6G8mR1AXgXy73r8qt/G5RsefKIlSj6jBMc8b9Wc=' } // PlaygroundOutput is defined in playground.js which is prepended