Skip to content

Commit

Permalink
tutorial fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
javierdelapuente committed Oct 4, 2024
1 parent cd58c67 commit 6215c1d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 14 deletions.
2 changes: 1 addition & 1 deletion docs/tutorial/code/go/cmd/anotherserver/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

func helloWorld(w http.ResponseWriter, req *http.Request) {
log.Printf("anotherserver hello world request")
fmt.Fprintf(w, "Hello World from anotherserver")
fmt.Fprintf(w, "Hello, world! (from anotherserver)\n")
}

func main() {
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorial/code/go/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

func helloWorld(w http.ResponseWriter, req *http.Request) {
log.Printf("new hello world request")
fmt.Fprintf(w, "Hello World")
fmt.Fprintf(w, "Hello, world!\n")
}

func main() {
Expand Down
4 changes: 2 additions & 2 deletions docs/tutorial/code/go/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ execute: |
# [docs:curl-go-rock]
curl --fail localhost:8000
# [docs:curl-go-rock-end]
[ "$(curl localhost:8000)" = "Hello World" ]
[ "$(curl localhost:8000)" = "Hello, world!" ]
# [docs:get-logs]
sudo docker exec go-hello-world pebble logs go
Expand Down Expand Up @@ -94,7 +94,7 @@ execute: |
# [docs:curl-anotherserver]
curl --fail localhost:8000
# [docs:curl-anotherserver-end]
[ "$(curl localhost:8000)" = "Hello World from anotherserver" ]
[ "$(curl localhost:8000)" = "Hello, world! (from anotherserver)" ]
# [docs:stop-docker-updated]
sudo docker stop go-hello-world
Expand Down
17 changes: 7 additions & 10 deletions docs/tutorial/go.rst
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ Pack the rock:
``ROCKCRAFT_ENABLE_EXPERIMENTAL_EXTENSIONS`` is required whilst the Go
extension is experimental.

Once Rockcraft has finished packing the FastAPI rock, you'll find a new file in
Once Rockcraft has finished packing the Go rock, you'll find a new file in
your working directory (an `OCI <OCI_image_spec_>`_ archive) with the ``.rock``
extension:

Expand All @@ -138,7 +138,7 @@ extension:
on an ``amd64`` platform, the name of the ``.rock`` file will be different
for you.

By default, the ``go-framework` will use the ``bare`` base. You can improve
By default, the ``go-framework`` will use the ``bare`` base. You can improve
the developer experience changing the base to ``[email protected]``, but the
image size will increase.

Expand All @@ -165,7 +165,7 @@ Check that the image was successfully loaded into Docker:
:end-before: [docs:docker-images-end]
:dedent: 2

The output should list the FastAPI container image, along with its tag, ID and
The output should list the Go container image, along with its tag, ID and
size:

.. code-block:: text
Expand Down Expand Up @@ -196,7 +196,7 @@ application's root endpoint which is running inside the container:
:end-before: [docs:curl-go-rock-end]
:dedent: 2

The Go application should again respond with ``Hello World``.
The Go application should again respond with ``Hello, world!``.


View the application logs
Expand All @@ -218,11 +218,8 @@ You should expect to see something similar to this:
.. code-block:: text
:class: log-snippets
2024-10-01T06:32:50.180Z [fastapi] INFO: Started server process [12]
2024-10-01T06:32:50.181Z [fastapi] INFO: Waiting for application startup.
2024-10-01T06:32:50.181Z [fastapi] INFO: Application startup complete.
2024-10-01T06:32:50.182Z [fastapi] INFO: Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
2024-10-01T06:32:58.214Z [fastapi] INFO: 172.17.0.1:55232 - "GET / HTTP/1.1" 200 OK
2024-10-04T08:51:35.826Z [go] 2024/10/04 08:51:35 starting hello world application
2024-10-04T08:51:39.974Z [go] 2024/10/04 08:51:39 new hello world request
You can also choose to follow the logs by using the ``-f`` option with the
``pebble logs`` command above. To stop following the logs, press :kbd:`Ctrl` + :kbd:`C`.
Expand Down Expand Up @@ -293,7 +290,7 @@ binary in ``anotherserver``:
:dedent: 2


The Go application should respond with ``Hello World from anotherserver``.
The Go application should respond with ``Hello, world! (from anotherserver)``.


.. note::
Expand Down

0 comments on commit 6215c1d

Please sign in to comment.