Explain the use of Go functions for encapsulating code logic?