crazybber / awesome-patterns

Collections of Go patterns based on tmrts/go-patterns, But merged with other awesome forks and more improvoments.

Home Page:https://crazybber.github.io/awesome-patterns/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unreachable code in semaphore.md

tommasodotNET opened this issue · comments

In the semaphore pattern, the Release func has an unreachable return statement:

func (s *implementation) Release() error {
	select {
	case _ = <-s.sem:
		return nil
	case <-time.After(s.timeout):
		return ErrIllegalRelease
	}

	return nil
}

The last return nil will never be reached.

fixed in #5