# How to expose ignore package?

**URL:** https://forum.syncthing.net/t/how-to-expose-ignore-package/10356
**Category:** Development
**Created:** [August 12, 2017, 10:05pm UTC](https://forum.syncthing.net/t/how-to-expose-ignore-package/10356 "2017-08-12T22:05:16Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![imsodin](https://forum.syncthing.net/user_avatar/forum.syncthing.net/imsodin/32/3317_2.png) [@imsodin](https://forum.syncthing.net/u/imsodin)
#### Post date: [August 12, 2017, 10:05pm UTC](https://forum.syncthing.net/t/how-to-expose-ignore-package/10356/1 "2017-08-12T22:05:16Z")

</div>

While looking for the cause of [Reason for panic maybe too little RAM?](https://forum.syncthing.net/t/reason-for-panic-maybe-too-little-ram/10346) I came upon some things that need mending or I would like to change/optimize around ignoring.

The main issue is around how the functionality of the ignore package is exposed. Currently this is done with the exported `Matcher` struct and pointer methods on it. Some of these methods do check that the pointer is non-nil, others don’t. To make this consistent all exported methods can make such a check, essentially making a nil pointer a valid `Matcher` that matches nothing. The other option is to never check whether the pointer is nil. Thus calling a function on a nil pointer is considered a programming error and panics.

Personally I tend to not do these checks. The existence of a “constructor” (`ignore.New`) which returns a `Matcher` pointer that matches nothing seems redundant/contradictory to giving the same functionality to a nil pointer. And this doesn’t have the risk of forgetting to add the nil check when adding a new method.

@AudriusButkevicius expressed that he prefers the nil-checks and that is also (partially) what is already in place.

What are the advantages of (consistently) use such nil checks and/or problems with not having them at all?

---

<div class="post-metadata">

### Author: ![AudriusButkevicius](https://forum.syncthing.net/user_avatar/forum.syncthing.net/audriusbutkevicius/32/277_2.png) [@AudriusButkevicius](https://forum.syncthing.net/u/AudriusButkevicius)
#### Post date: [August 13, 2017, 1:38am UTC](https://forum.syncthing.net/t/how-to-expose-ignore-package/10356/2 "2017-08-13T01:38:37Z")

</div>

There are a few other cases in the model package where we prefer nil check in the model, so I think handling nil cases everywhere is the right thing.
