From 05d33590a912d80025c37a78be6b57a6c71d0a68 Mon Sep 17 00:00:00 2001 From: Daniele Brugnara Date: Thu, 11 Feb 2021 17:18:43 +0100 Subject: [PATCH 1/5] Better suggestions for error handling --- exercises/practice/hamming/.docs/instructions.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/exercises/practice/hamming/.docs/instructions.md b/exercises/practice/hamming/.docs/instructions.md index 56c5696de..cc458ff19 100644 --- a/exercises/practice/hamming/.docs/instructions.md +++ b/exercises/practice/hamming/.docs/instructions.md @@ -20,5 +20,12 @@ The Hamming Distance is useful for lots of things in science, not just biology, The Hamming distance is only defined for sequences of equal length, so an attempt to calculate it between sequences of different lengths should -not work. The general handling of this situation (e.g., raising an -exception vs returning a special value) may differ between languages. +not work, returning an error. + +With this exercise, you are introduced to the use of +[multiple results](https://tour.golang.org/basics/6) feature and here there +is an example with [errors](https://tour.golang.org/methods/19): + + func Foo(a, b string) (string, error) { + return "", errors.New("An error occured!") + } From 5677928b3d0ba657de52084d0f3bf3f5ac4d36a3 Mon Sep 17 00:00:00 2001 From: Daniele Brugnara Date: Thu, 11 Feb 2021 17:23:06 +0100 Subject: [PATCH 2/5] Fixed typo --- exercises/practice/hamming/.docs/instructions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/practice/hamming/.docs/instructions.md b/exercises/practice/hamming/.docs/instructions.md index cc458ff19..588bfef8c 100644 --- a/exercises/practice/hamming/.docs/instructions.md +++ b/exercises/practice/hamming/.docs/instructions.md @@ -27,5 +27,5 @@ With this exercise, you are introduced to the use of is an example with [errors](https://tour.golang.org/methods/19): func Foo(a, b string) (string, error) { - return "", errors.New("An error occured!") + return "", errors.New("An error occurred!") } From 90559877aa488d6eeb656b22d7a51a3f591ccf91 Mon Sep 17 00:00:00 2001 From: Daniele Brugnara Date: Tue, 16 Feb 2021 11:48:07 +0100 Subject: [PATCH 3/5] Instructions.append --- .../practice/hamming/.docs/instructions.append.md | 10 +++++++++- exercises/practice/hamming/.docs/instructions.md | 8 -------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/exercises/practice/hamming/.docs/instructions.append.md b/exercises/practice/hamming/.docs/instructions.append.md index 01d1ca9ad..5ea1bf39d 100644 --- a/exercises/practice/hamming/.docs/instructions.append.md +++ b/exercises/practice/hamming/.docs/instructions.append.md @@ -1,6 +1,14 @@ # Instructions append +With this exercise, you are introduced to the use of +[multiple results](https://tour.golang.org/basics/6) feature and here there +is an example with [errors](https://tour.golang.org/methods/19): + + func Foo(a, b string) (string, error) { + return "", errors.New("An error occurred!") + } + You may be wondering about the `cases_test.go` file. We explain it in the [leap exercise][leap-exercise-readme]. -[leap-exercise-readme]: https://github.com/exercism/go/blob/master/exercises/leap/README.md +[leap-exercise-readme]: https://github.com/exercism/go/blob/master/exercises/leap/README.md diff --git a/exercises/practice/hamming/.docs/instructions.md b/exercises/practice/hamming/.docs/instructions.md index 588bfef8c..59d51880b 100644 --- a/exercises/practice/hamming/.docs/instructions.md +++ b/exercises/practice/hamming/.docs/instructions.md @@ -21,11 +21,3 @@ The Hamming Distance is useful for lots of things in science, not just biology, The Hamming distance is only defined for sequences of equal length, so an attempt to calculate it between sequences of different lengths should not work, returning an error. - -With this exercise, you are introduced to the use of -[multiple results](https://tour.golang.org/basics/6) feature and here there -is an example with [errors](https://tour.golang.org/methods/19): - - func Foo(a, b string) (string, error) { - return "", errors.New("An error occurred!") - } From ca2590e21d345fa40af2b30c5c20a8ebdd7d9678 Mon Sep 17 00:00:00 2001 From: Daniele Date: Tue, 16 Feb 2021 16:49:44 +0100 Subject: [PATCH 4/5] Update exercises/practice/hamming/.docs/instructions.md Applied suggestion. Co-authored-by: Erik Schierboom --- exercises/practice/hamming/.docs/instructions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/practice/hamming/.docs/instructions.md b/exercises/practice/hamming/.docs/instructions.md index 59d51880b..0db9b1ea9 100644 --- a/exercises/practice/hamming/.docs/instructions.md +++ b/exercises/practice/hamming/.docs/instructions.md @@ -20,4 +20,4 @@ The Hamming Distance is useful for lots of things in science, not just biology, The Hamming distance is only defined for sequences of equal length, so an attempt to calculate it between sequences of different lengths should -not work, returning an error. +not work. From 77620d7356355cb77c355ebe6c9c6651b56b2775 Mon Sep 17 00:00:00 2001 From: Daniele Brugnara Date: Mon, 22 Feb 2021 20:12:52 +0100 Subject: [PATCH 5/5] relinks --- exercises/practice/hamming/.docs/instructions.append.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exercises/practice/hamming/.docs/instructions.append.md b/exercises/practice/hamming/.docs/instructions.append.md index 5ea1bf39d..2290ea65f 100644 --- a/exercises/practice/hamming/.docs/instructions.append.md +++ b/exercises/practice/hamming/.docs/instructions.append.md @@ -1,8 +1,8 @@ # Instructions append With this exercise, you are introduced to the use of -[multiple results](https://tour.golang.org/basics/6) feature and here there -is an example with [errors](https://tour.golang.org/methods/19): +[multiple results](multiple_returns) feature and here there +is an example with [errors](errors) func Foo(a, b string) (string, error) { return "", errors.New("An error occurred!")