Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add name of forders in code tags, URL can click #201

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 22 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@

[![Go Reference](https://pkg.go.dev/badge/golang.org/x/website.svg)](https://pkg.go.dev/golang.org/x/website)

This repo holds content and serving programs for the go.dev and golang.org web sites.
This repo holds content and serving programs for the https://go.dev website.

Content is in \_content/ (go.dev) and tour/ (go.dev/tour).
Server code is in cmd/ and internal/.
Content is in `_content/` (https://go.dev) and `tour/` (https://go.dev/tour).
Server code is in `cmd/` and `internal/` .

To run the combined go.dev+golang.org server to preview local content changes, use:
To run https://go.dev server to preview local content changes, use
```bash
go run ./cmd/golangorg
```
The supporting programs `cmd/admingolangorg` and `cmd/googlegolangorg`
are the servers for https://admin.golang.org and https://google.golang.org.
They do not use the `_content/` directories.

go run ./cmd/golangorg

The supporting programs cmd/admingolangorg and cmd/googlegolangorg
are the servers for admin.golang.org and google.golang.org.
(They do not use the \_content/ directories.)

Each command directory has its own README.md explaining deployment.
Each command directory has its own `README.md` explaining deployment.

## JS/TS/CSS Formatting

This repository uses [eslint](https://eslint.org/) to format JS and TS files,
This repository uses [eslint](https://eslint.org/) to format JavaScript and TypeScript files,
and [stylelint](https://stylelint.io/) to format CSS files.

See also:
Expand All @@ -28,14 +28,14 @@ See also:
- [JavaScript](https://google.github.io/styleguide/jsguide.html)
- [TypeScript](https://google.github.io/styleguide/tsguide.html)

It is encouraged that all JS, TS, and CSS code be run through formatters before
It is encouraged that all JavaScript, TypeScript, and CSS code be run through formatters before
submitting a change. However, it is not a strict requirement enforced by CI.

### Installing npm Dependencies:
### Installing npm Dependencies

1. Install [docker](https://docs.docker.com/get-docker/)
2. Create a .gitignore file at repo root
3. Add .gitignore and node_modules to .gitignore
2. Create a `.gitignore` file at repo root
3. Add `.gitignore` and `node_modules` to `.gitignore`
4. Run `./npm install`

### Run ESlint
Expand All @@ -51,15 +51,17 @@ submitting a change. However, it is not a strict requirement enforced by CI.
TypeScript files served from _content are transformed into JavaScript.
Reference .ts files in html templates as module code.

`<script type="module" src="/ts/filename.ts">`
```html
<script type="module" src="/ts/filename.ts">
```

Write unit tests for TypeScript code using the [jest](https://jestjs.io/)
testing framework.

### Run Jest

./npx jest [TestPathPattern]

```bash
./npx jest [TestPathPattern]
```
## Deploying

Each time a CL is reviewed and submitted, the code is deployed to App Engine.
Expand Down
30 changes: 15 additions & 15 deletions _content/doc/tutorial/fuzz.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,15 @@ In this step, you’ll add a function to reverse a string.
2. Into main.go, at the top of the file, paste the following package
declaration.

```
```go
package main
```

A standalone program (as opposed to a library) is always in package `main`.

3. Beneath the package declaration, paste the following function declaration.

```
```go
func Reverse(s string) string {
b := []byte(s)
for i, j := 0, len(b)-1; i {{raw "<"}} len(b)/2; i, j = i+1, j-1 {
Expand All @@ -121,7 +121,7 @@ In this step, you’ll add a function to reverse a string.
`main` function to initialize a string, reverse it, print the output, and
repeat.

```
```go
func main() {
input := "The quick brown fox jumped over the lazy dog"
rev := Reverse(input)
Expand All @@ -140,7 +140,7 @@ In this step, you’ll add a function to reverse a string.

The first lines of code should look like this:

```
```go
package main

import "fmt"
Expand Down Expand Up @@ -172,7 +172,7 @@ In this step, you will write a basic unit test for the `Reverse` function.
directory.
2. Paste the following code into reverse_test.go.

```
```go
package main

import (
Expand Down Expand Up @@ -203,7 +203,7 @@ In this step, you will write a basic unit test for the `Reverse` function.

Run the unit test using `go test`

```
```go
$ go test
PASS
ok example/fuzz 0.013s
Expand All @@ -230,7 +230,7 @@ test.
In your text editor, replace the unit test in reverse_test.go with the following
fuzz test.

```
```go
func FuzzReverse(f *testing.F) {
testcases := []string{"Hello, world", " ", "!12345"}
for _, tc := range testcases {
Expand Down Expand Up @@ -402,7 +402,7 @@ of runes in the reversed string.
In your text editor, replace the fuzz target within `FuzzReverse` with the
following.

```
```go
f.Fuzz(func(t *testing.T, orig string) {
rev := Reverse(orig)
doubleRev := Reverse(rev)
Expand Down Expand Up @@ -454,7 +454,7 @@ of by bytes.

In your text editor, replace the existing Reverse() function with the following.

```
```go
func Reverse(s string) string {
r := []rune(s)
for i, j := 0, len(r)-1; i {{raw "<"}} len(r)/2; i, j = i+1, j-1 {
Expand Down Expand Up @@ -531,7 +531,7 @@ replacement UTF-8 character to the input byte slice, they are clearly not equal.

1. In your text editor, replace the `Reverse` function with the following.

```
```go
func Reverse(s string) string {
fmt.Printf("input: %q\n", s)
r := []rune(s)
Expand Down Expand Up @@ -585,7 +585,7 @@ UTF-8.
1. In your text editor, replace the existing `Reverse` function with the
following.

```
```go
func Reverse(s string) (string, error) {
if !utf8.ValidString(s) {
return s, errors.New("input is not valid UTF-8")
Expand All @@ -605,7 +605,7 @@ UTF-8.
discard the extra error value. Replace the existing `main` function with the
following.

```
```go
func main() {
input := "The quick brown fox jumped over the lazy dog"
rev, revErr := Reverse(input)
Expand All @@ -622,7 +622,7 @@ UTF-8.
1. You will need to import the errors and the unicode/utf8 packages.
The import statement in main.go should look like the following.

```
```go
import (
"errors"
"fmt"
Expand All @@ -633,7 +633,7 @@ UTF-8.
1. Modify the reverse_test.go file to check for errors and skip the test if
errors are generated by returning.

```
```go
func FuzzReverse(f *testing.F) {
testcases := []string {"Hello, world", " ", "!12345"}
for _, tc := range testcases {
Expand Down Expand Up @@ -810,4 +810,4 @@ func FuzzReverse(f *testing.F) {
}
```

[Back to top](#top)
[Back to top](#top)