Go / birdwatcher exercise

Hello there! I don’t really have idea what’s happening but when I implement this function inside the website code editor

// FixBirdCountLog returns the bird counts after correcting
// the bird counts for alternate days.
func FixBirdCountLog(birdsPerDay []int) []int {
    for i := range birdsPerDay { 
        if i % 2 == 0 {
            birdsPerDay[i] = birdsPerDay[i] + 1
        }
    }
	return birdsPerDay
	panic("Please implement the FixBirdCountLog() function")
}

It gives me back the error :

# birdwatcher [birdwatcher.test]
./bird_watcher.go:33:6: syntax error: unexpected FixBirdCountLog, expected (
FAIL	birdwatcher [build failed]
'/usr/local/go/bin/go test --short --json .' returned exit code 1: exit status 1

However, when I run this one locally it works correctly. I don’r really sure is it bug or nah, just can’t get why complier says there is a syntax error :roll_eyes:

Which line is line 33? Can you share the entire source file? That error might be related to prior lines.

the 33th line is actually here :

func FixBirdCountLog(birdsPerDay []int) []int {

and there’s the source Bird Watcher in Go on Exercism

I assume it can be the source problem. I have already sent the bug message to the team through the code editor, but as soon as I really don’t know what the problem is I started this topic on forum.

Can you share your entire code/solution? Please paste all your code here, not just one function.

package birdwatcher

// TotalBirdCount return the total bird count by summing
// the individual day's counts.
func TotalBirdCount(birdsPerDay []int) int {
    var res int
    for _, value := range birdsPerDay {
        res += value
    }
	return res
	
	panic("Please implement the TotalBirdCount() function")
}

// BirdsInWeek returns the total bird count by summing
// only the items belonging to the given week.
func BirdsInWeek(birdsPerDay []int, week int) int {
    var res int
    if week == 1 { 
        for i := 0; i<=7; i++ {
        	res += birdsPerDay[i]   
        } 
    } else if week == 2 { 
    	for i := 7; i<=14; i++ {
        res += birdsPerDay[i]
    }
	return res
	panic("Please implement the BirdsInWeek() function")
}

// FixBirdCountLog returns the bird counts after correcting
// the bird counts for alternate days.
func FixBirdCountLog(birdsPerDay []int) []int {
    for i := range birdsPerDay { 
        if i % 2 == 0 {
            birdsPerDay[i] = birdsPerDay[i] + 1
        }
    }
	return birdsPerDay
	panic("Please implement the FixBirdCountLog() function")
}

Count the number of { and } in the prior function. They are different. That’s the reason you’re getting a syntax error.