Repository: pterm/pterm
Pull request #220 (2021-06-07 11:37:35)

refactor(prefix): `pterm.Error` default no line number shown
### Description
Change `pterm.Error` default to no line number shown.

### Scope
> What is affected by this pull request?

- [ ] Bug Fix
- [ ] New Feature
- [ ] Documentation
- [x] Other

### Related Issue
Fixes #


### To-Do Checklist
- [x] I tested my changes
- [ ] I have commented every method that I created/changed
- [ ] I updated the examples to fit with my changes
- [x] I have added tests for my newly created methods


codecov[bot]: # [Codecov](https://codecov.io/gh/pterm/pterm/pull/220?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pterm) Report
> Merging [#220](https://codecov.io/gh/pterm/pterm/pull/220?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pterm) (ea3adcd) into [master](https://codecov.io/gh/pterm/pterm/commit/6ff3ad2cff8dfaa75d0ed2fcdbeb8d2df02961da?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pterm) (6ff3ad2) will **not change** coverage.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/pterm/pterm/pull/220/graphs/tree.svg?width=650&height=150&src=pr&token=C3EX231V76&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pterm)](https://codecov.io/gh/pterm/pterm/pull/220?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pterm)

```diff
@@            Coverage Diff            @@
##            master      #220   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           24        24           
  Lines         1243      1243           
=========================================
  Hits          1243      1243           
```


| [Impacted Files](https://codecov.io/gh/pterm/pterm/pull/220?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pterm) | Coverage Δ | |
|---|---|---|
| [prefix\_printer.go](https://codecov.io/gh/pterm/pterm/pull/220/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pterm#diff-cHJlZml4X3ByaW50ZXIuZ28=) | `100.00% <ø> (ø)` | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pterm/pterm/pull/220?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pterm).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pterm)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pterm/pterm/pull/220?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pterm). Last update [cac1f17...ea3adcd](https://codecov.io/gh/pterm/pterm/pull/220?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pterm). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pterm).


Patch:
diff --git a/prefix_printer.go b/prefix_printer.go
index 43268c38..77b73d90 100644
--- a/prefix_printer.go
+++ b/prefix_printer.go
@@ -48,7 +48,6 @@ var (
 			Style: &ThemeDefault.ErrorPrefixStyle,
 			Text:  " ERROR ",
 		},
-		ShowLineNumber: true,
 	}
 
 	// Fatal returns a PrefixPrinter, which can be used to print text with an "fatal" Prefix.


Test patch:
diff --git a/prefix_printer_test.go b/prefix_printer_test.go
index 2c878650..b13c3699 100644
--- a/prefix_printer_test.go
+++ b/prefix_printer_test.go
@@ -35,6 +35,13 @@ func TestPrefixPrinterPrintMethods(t *testing.T) {
 			})
 		})
 
+		t.Run("PrintWithShowLineNumber", func(t *testing.T) {
+			testPrintContains(t, func(w io.Writer, a interface{}) {
+				p2 := p.WithShowLineNumber()
+				p2.Print(a)
+			})
+		})
+
 		t.Run("PrintWithMultipleLines", func(t *testing.T) {
 			p2 := p.WithScope(Scope{
 				Text:  "test",