Thinking like Mr. Goat :),
Approach A:
the only way he can reach the flowers is by:
(A) going around the hut (since it is a solid structure, and assuming he can't jump it) following the blue line until he reaches point F. This is 3+4=7 M.
(B) And from that point he could either go forward, right or left using the remaining length of the rope. This is 8-(3+4)=1 Meter. This length will be consumed either in the left direction or in the right direction so it will be used once only.
The total rope length is the lengths used in (A) + (B) which is 7 M.
The fence will be built at the red line with the length of 2 Meters, that is, 1 Meter in either directions.
This approach is simple but not quite correct (see comment below).

Approach B
This was added as a result of the valid comment below. The following argument is for the 2nd diagram.
1 - If the Goat moves from point P, the max. distance he could cover would be along the radius of circle A bounded by the rectangle sides, the hut walls and the horizontal line L since the roap will bend at the wall of the hut at point C. This path alone will not get the Goat to the flowers.
2 - If the Goat moves from point P along the side of the hut reaching point C, then the max. distance he could cover would be along the radius of circle B bounded by the hut wall. He may then go to corner point Q. The max. distance he could cover would be along the radius of circle C bounded by the rectangle sides and the hut walls.
The flowers will act as a tangent to circle C at 1 point (theoretically) and that is where the fence should be built.
