In this correspondence a generalization of algebraic-geometry codes based o
n function fields over finite fields with many places of small degree is pr
esented. It turns out that many good linear codes can be obtained from thes
e generalized algebraic-geometry codes. In particular, we calculate some ex
amples of q-ary linear codes for q = 2,3, 5. These examples show that many
best possible linear codes can be found from our construction.